antvis/G6

The issue has been closed
TypeScript cannot compile with "strict: true" #2621
BlackGlory posted onGitHub
- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
https://repl.it/@BlackGlory/g6
Steps to reproduce
index.ts
import { Graph } from '@antv/g6'
package.json
{
"scripts": {
"build": "tsc --project tsconfig.json"
},
"dependencies": {
"@antv/g6": "^4.1.6",
"typescript": "^4.1.3"
}
}
tsconfig.json
{
"compilerOptions": {
"target": "ES2020"
, "module": "CommonJS"
, "strict": true
}
}
yarn build
Environment | Info |
---|---|
g6 | 4.1.6 |
System | - |
Browser | - |
node_modules/@antv/g6-core/lib/graph/graph.d.ts:199:5 - error TS2416: Property 'updateBehavior' in type 'AbstractGraph' is not assignable to the same property in base type 'IAbstractGraph'.
Type '(behavior: string, newCfg: object, mode?: string | undefined) => AbstractGraph' is not assignable to type '(behavior: string, newCfg: object, modes: string | string[]) => AbstractGraph'.
Types of parameters 'mode' and 'modes' are incompatible.
Type 'string | string[]' is not assignable to type 'string | undefined'.
Type 'string[]' is not assignable to type 'string'.
199 updateBehavior(behavior: string, newCfg: object, mode?: string): AbstractGraph;
~~~~~~~~~~~~~~
node_modules/@antv/g6-core/lib/item/combo.d.ts:11:5 - error TS2416: Property 'getShapeCfg' in type 'Combo' is not assignable to the same property in base type 'ICombo'.
Type '(model: ComboConfig) => ComboConfig' is not assignable to type '(model: ModelConfig) => ModelConfig'.
Types of parameters 'model' and 'model' are incompatible.
Property 'id' is missing in type 'ModelConfig' but required in type 'ComboConfig'.
11 getShapeCfg(model: ComboConfig): ComboConfig;
~~~~~~~~~~~
node_modules/@antv/g6-core/lib/types/index.d.ts:407:5
407 id: string;
~~
'id' is declared here.
node_modules/@antv/g6-core/lib/item/combo.d.ts:66:5 - error TS2416: Property 'removeNode' in type 'Combo' is not assignable to the same property in base type 'ICombo'.
Type '(node: INode) => boolean' is not assignable to type '(node: string | INode) => boolean'.
Types of parameters 'node' and 'node' are incompatible.
Type 'string | INode' is not assignable to type 'INode'.
Type 'string' is not assignable to type 'INode'.
66 removeNode(node: INode): boolean;
~~~~~~~~~~
node_modules/@antv/g6-core/lib/item/node.d.ts:68:5 - error TS2416: Property 'isOnlyMove' in type 'Node' is not assignable to the same property in base type 'INode'.
Type '(cfg: NodeConfig) => boolean' is not assignable to type '(cfg: ModelConfig) => boolean'.
Types of parameters 'cfg' and 'cfg' are incompatible.
Property 'id' is missing in type 'ModelConfig' but required in type 'NodeConfig'.
68 isOnlyMove(cfg: NodeConfig): boolean;
~~~~~~~~~~
node_modules/@antv/g6-core/lib/types/index.d.ts:339:5
339 id: string;
~~
'id' is declared here.
node_modules/@antv/g6-pc/lib/graph/graph.d.ts:5:22 - error TS2420: Class 'Graph' incorrectly implements interface 'IGraph'.
Types of property 'updateBehavior' are incompatible.
Type '(behavior: string, newCfg: object, mode?: string | undefined) => AbstractGraph' is not assignable to type '(behavior: string, newCfg: object, modes: string | string[]) => AbstractGraph'.
5 export default class Graph extends AbstractGraph implements IGraph {
~~~~~
node_modules/@antv/g6-pc/lib/graph/tree-graph.d.ts:4:22 - error TS2420: Class 'TreeGraph' incorrectly implements interface 'ITreeGraph'.
Types of property 'updateBehavior' are incompatible.
Type '(behavior: string, newCfg: object, mode?: string | undefined) => AbstractGraph' is not assignable to type '(behavior: string, newCfg: object, modes: string | string[]) => AbstractGraph'.
4 export default class TreeGraph extends Graph implements ITreeGraph {
~~~~~~~~~
Found 6 errors.
<!-- generated by antv-issue-helper. DO NOT REMOVE -->