Enable TypeScript `noImplicitThis` (#761)
This commit is contained in:
parent
db227084be
commit
aa308b3e4d
|
@ -733,15 +733,16 @@ export class D3ForceGraph implements GraphRenderer {
|
||||||
.attr("aria-label", (d: D3Node) => {
|
.attr("aria-label", (d: D3Node) => {
|
||||||
return this.retrieveNodeCaption(d);
|
return this.retrieveNodeCaption(d);
|
||||||
})
|
})
|
||||||
.on("dblclick", function (_: MouseEvent, d: D3Node) {
|
.on("dblclick", function (this: Element, _: MouseEvent, d: D3Node) {
|
||||||
|
// https://stackoverflow.com/a/41945742 ('this' implicitly has type 'any' because it does not have a type annotation)
|
||||||
// this is the <g> element
|
// this is the <g> element
|
||||||
self.onNodeClicked(this.parentNode, d);
|
self.onNodeClicked(this.parentNode, d);
|
||||||
})
|
})
|
||||||
.on("click", function (_: MouseEvent, d: D3Node) {
|
.on("click", function (this: Element, _: MouseEvent, d: D3Node) {
|
||||||
// this is the <g> element
|
// this is the <g> element
|
||||||
self.onNodeClicked(this.parentNode, d);
|
self.onNodeClicked(this.parentNode, d);
|
||||||
})
|
})
|
||||||
.on("keypress", function (event: KeyboardEvent, d: D3Node) {
|
.on("keypress", function (this: Element, event: KeyboardEvent, d: D3Node) {
|
||||||
if (event.charCode === Constants.KeyCodes.Space || event.charCode === Constants.KeyCodes.Enter) {
|
if (event.charCode === Constants.KeyCodes.Space || event.charCode === Constants.KeyCodes.Enter) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
// this is the <g> element
|
// this is the <g> element
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"allowUnreachableCode": false,
|
"allowUnreachableCode": false,
|
||||||
|
@ -14,13 +15,24 @@
|
||||||
"target": "es2017",
|
"target": "es2017",
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"lib": ["es5", "es6", "dom"],
|
"lib": [
|
||||||
|
"es5",
|
||||||
|
"es6",
|
||||||
|
"dom"
|
||||||
|
],
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"types": ["jest"]
|
"types": [
|
||||||
|
"jest"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"include": ["./src/**/*", "./utils/**/*"],
|
"include": [
|
||||||
"exclude": ["./src/**/__mocks__/**/*"]
|
"./src/**/*",
|
||||||
}
|
"./utils/**/*"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"./src/**/__mocks__/**/*"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue