Skip to content

[Bug]: TypeScript 类型检查报错 #7355

@HCD-YunpengMiao

Description

@HCD-YunpengMiao

Describe the bug / 问题描述

tsc -b

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/elements/nodes/base-node.ts:332:23 - error TS6133: 'attributes' is declared but its value is never read.

332   protected getPortXY(attributes: Required<S>, style: NodePortStyleProps): Point {
                          ~~~~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/elements/nodes/image.ts:67:60 - error TS6133: 'keyStyle' is declared but its value is never read.

67     const { fill: keyStyleFill, stroke: keyStyleStroke, ...keyStyle } = this.getShape<GRect>('key').attributes;
                                                              ~~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/layouts/index.ts:1:59 - error TS7016: Could not find a declaration file for module '@antv/hierarchy'. 'C:/WorkSpace/hcd_back/orion/orion-ui/node_modules/.pnpm/@[email protected]/node_modules/@antv/hierarchy/build/hierarchy.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/antv__hierarchy` if it exists or add a new declaration (.d.ts) file containing `declare module '@antv/hierarchy';`

1 export { compactBox, dendrogram, indented, mindmap } from '@antv/hierarchy';
                                                            ~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/plugins/hull/hull/robust-orientation.ts:18:3 - error TS6133: 'scale' is declared but its value is never read.

18   scale: typeof robustScale,
     ~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/plugins/hull/hull/robust-orientation.ts:404:3 - error TS6133: 'o0' is declared but its value is never read.

404   o0: Function,
      ~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/plugins/hull/hull/robust-orientation.ts:405:3 - error TS6133: 'o1' is declared but its value is never read.

405   o1: Function,
      ~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/plugins/legend.ts:2:36 - error TS2307: Cannot find module '@antv/component/lib/ui/legend/types' or its corresponding type declarations.

2 import { CategoryStyleProps } from '@antv/component/lib/ui/legend/types';
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/runtime/behavior.ts:76:58 - error TS2345: Argument of type 'Target' is not assignable to parameter of type 'DisplayObject<any, any>'.
  Type 'Document' is missing the following properties from type 'DisplayObject<any, any>': config, isCustomElement, isMutationObserved, activeAnimations, and 114 more.

76     if ('destroyed' in targetElement && (isToBeDestroyed(targetElement) || targetElement.destroyed)) return;
                                                            ~~~~~~~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/runtime/layout.ts:196:72 - error TS6133: 'index' is declared but its value is never read.

196   private async treeLayout(data: GraphData, options: STDLayoutOptions, index: number): Promise<GraphData> {
                                                                           ~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/runtime/viewport.ts:134:25 - error TS2345: Argument of type 'vec3' is not assignable to parameter of type '[number, number] | Float32Array | [number, number, number]'.
  Type 'IndexedCollection' is not assignable to type '[number, number] | Float32Array | [number, number, number]'.
    Type 'IndexedCollection' is missing the following properties from type 'Float32Array': BYTES_PER_ELEMENT, buffer, byteLength, byteOffset, and 25 more.

134           position: add(position, delta),
                            ~~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/runtime/viewport.ts:135:27 - error TS2345: Argument of type 'vec3' is not assignable to parameter of type '[number, number] | Float32Array | [number, number, number]'.
  Type 'IndexedCollection' is not assignable to type '[number, number] | Float32Array | [number, number, number]'.
    Type 'IndexedCollection' is missing the following properties from type 'Float32Array': BYTES_PER_ELEMENT, buffer, byteLength, byteOffset, and 25 more.

135           focalPoint: add(focalPoint, delta),
                              ~~~~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/transforms/base-transform.ts:14:37 - error TS6133: 'context' is declared but its value is never read.

14   public beforeDraw(data: DrawData, context: DrawContext): DrawData {
                                       ~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/transforms/base-transform.ts:20:22 - error TS6133: 'type' is declared but its value is never read.

20   public afterLayout(type: 'pre' | 'post', data?: DrawData) {}
                        ~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/transforms/base-transform.ts:20:44 - error TS6133: 'data' is declared but its value is never read.

20   public afterLayout(type: 'pre' | 'post', data?: DrawData) {}
                                              ~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/transforms/collapse-expand-node.ts:86:30 - error TS6133: 'node' is declared but its value is never read.

86     nodesToCollapse.forEach((node, id) => {
                                ~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/utils/element.ts:151:3 - error TS2322: Type 'IndexedCollection' is not assignable to type 'Point'.
  Type 'IndexedCollection' is missing the following properties from type 'Float32Array': BYTES_PER_ELEMENT, buffer, byteLength, byteOffset, and 25 more.

151   return isPoint(port) ? port : port.getPosition();
      ~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/utils/element.ts:249:37 - error TS2322: Type 'vec3' is not assignable to type 'Point'.
  Type 'IndexedCollection' is not assignable to type 'Point'.
    Type 'IndexedCollection' is missing the following properties from type 'Float32Array': BYTES_PER_ELEMENT, buffer, byteLength, byteOffset, and 25 more.

249   if (port.attributes.linkToCenter) return port.getPosition();
                                        ~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/utils/element.ts:260:35 - error TS2345: Argument of type 'IndexedCollection' is not assignable to parameter of type 'Point'.
  Type 'IndexedCollection' is missing the following properties from type 'Float32Array': BYTES_PER_ELEMENT, buffer, byteLength, byteOffset, and 25 more.

260   return getEllipseIntersectPoint(oppositePosition, port.getBounds());
                                      ~~~~~~~~~~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/utils/element.ts:279:37 - error TS2345: Argument of type 'IndexedCollection' is not assignable to parameter of type 'Point'.
  Type 'IndexedCollection' is missing the following properties from type 'Float32Array': BYTES_PER_ELEMENT, buffer, byteLength, byteOffset, and 25 more.

279   return nodeLike.getIntersectPoint(oppositePosition) || nodeLike.getCenter();
                                        ~~~~~~~~~~~~~~~~


Found 19 errors.

PS C:\WorkSpace\hcd_back\orion\orion-ui> tsc -b
node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/runtime/behavior.ts:76:58 - error TS2345: Argument of type 'Target' is not assignable to parameter of type 'DisplayObject<any, any>'.
  Type 'Document' is missing the following properties from type 'DisplayObject<any, any>': config, isCustomElement, isMutationObserved, activeAnimations, and 114 more.

76     if ('destroyed' in targetElement && (isToBeDestroyed(targetElement) || targetElement.destroyed)) return;
                                                            ~~~~~~~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/runtime/viewport.ts:134:25 - error TS2345: Argument of type 'vec3' is not assignable to parameter of type '[number, number] | Float32Array | [number, number, number]'.
  Type 'IndexedCollection' is not assignable to type '[number, number] | Float32Array | [number, number, number]'.
    Type 'IndexedCollection' is missing the following properties from type 'Float32Array': BYTES_PER_ELEMENT, buffer, byteLength, byteOffset, and 25 more.

134           position: add(position, delta),
                            ~~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/runtime/viewport.ts:135:27 - error TS2345: Argument of type 'vec3' is not assignable to parameter of type '[number, number] | Float32Array | [number, number, number]'.
  Type 'IndexedCollection' is not assignable to type '[number, number] | Float32Array | [number, number, number]'.
    Type 'IndexedCollection' is missing the following properties from type 'Float32Array': BYTES_PER_ELEMENT, buffer, byteLength, byteOffset, and 25 more.

135           focalPoint: add(focalPoint, delta),
                              ~~~~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/utils/element.ts:151:3 - error TS2322: Type 'IndexedCollection' is not assignable to type 'Point'.
  Type 'IndexedCollection' is missing the following properties from type 'Float32Array': BYTES_PER_ELEMENT, buffer, byteLength, byteOffset, and 25 more.

151   return isPoint(port) ? port : port.getPosition();
      ~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/utils/element.ts:249:37 - error TS2322: Type 'vec3' is not assignable to type 'Point'.
  Type 'IndexedCollection' is not assignable to type 'Point'.
    Type 'IndexedCollection' is missing the following properties from type 'Float32Array': BYTES_PER_ELEMENT, buffer, byteLength, byteOffset, and 25 more.

249   if (port.attributes.linkToCenter) return port.getPosition();
                                        ~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/utils/element.ts:260:35 - error TS2345: Argument of type 'IndexedCollection' is not assignable to parameter of type 'Point'.
  Type 'IndexedCollection' is missing the following properties from type 'Float32Array': BYTES_PER_ELEMENT, buffer, byteLength, byteOffset, and 25 more.

260   return getEllipseIntersectPoint(oppositePosition, port.getBounds());
                                      ~~~~~~~~~~~~~~~~

node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@antv/g6/src/utils/element.ts:279:37 - error TS2345: Argument of type 'IndexedCollection' is not assignable to parameter of type 'Point'.
  Type 'IndexedCollection' is missing the following properties from type 'Float32Array': BYTES_PER_ELEMENT, buffer, byteLength, byteOffset, and 25 more.

279   return nodeLike.getIntersectPoint(oppositePosition) || nodeLike.getCenter();
                                        ~~~~~~~~~~~~~~~~

src/views/network/Topology/NetworkTopology.tsx:2:10 - error TS2614: Module '"@antv/g6"' has no exported member 'ExtensionCategory'. Did you mean to use 'import ExtensionCategory from "@antv/g6"' instead?

2 import { ExtensionCategory, Graph, register } from '@antv/g6';
           ~~~~~~~~~~~~~~~~~

src/views/network/Topology/NetworkTopology.tsx:2:29 - error TS2614: Module '"@antv/g6"' has no exported member 'Graph'. Did you mean to use 'import Graph from "@antv/g6"' instead?

2 import { ExtensionCategory, Graph, register } from '@antv/g6';
                              ~~~~~

src/views/network/Topology/NetworkTopology.tsx:2:36 - error TS2614: Module '"@antv/g6"' has no exported member 'register'. Did you mean to use 'import register from "@antv/g6"' instead?

2 import { ExtensionCategory, Graph, register } from '@antv/g6';
                                     ~~~~~~~~


Found 10 errors.

Reproduction link / 复现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

Version / 版本

Please select / 请选择

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他

Metadata

Metadata

Assignees

No one assigned

    Labels

    question 💬This issue is just a question. It will be converted into discussion automatically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions