Skip to content

[Bug] widget module causes tons of typescript errors #9832

@w1nklr

Description

@w1nklr

Description

Short:
A file in widgets module imports from '@deck.gl/core' src directory !
See https://github.com/visgl/deck.gl/blob/master/modules/widgets/src/reset-view-widget.tsx, line 6:
import type {ViewStateMap, ViewOrViews} from '@deck.gl/core/src/lib/view-manager';

Long:
Since the bump to deck.gl version 9.2+, compiling our project does issue tons of typescript errors in node_modules/@deck.gl/core/src/...

Example:

> @webviz/subsurface-viewer@1.14.2 transpile
> tsc --project ./tsconfig.json

../../node_modules/@deck.gl/core/src/controllers/controller.ts:21:24 - error TS7006: Parameter 't' implicitly has an 'any' type.

21 const INERTIA_EASING = t => 1 - (1 - t) * (1 - t);
                          ~

../../node_modules/@deck.gl/core/src/controllers/controller.ts:173:7 - error TS7032: Property 'events' implicitly has type 'any', because its set accessor lacks a parameter type annotation.

173   set events(customEvents) {
          ~~~~~~
...

Before 9.2.2 I still could force using @deck.gl/widgets version 9.1.15 :/ to avoid these compilation errors.
But not since version 9.2.2 any more.

Flavors

  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CARTO
  • ArcGIS

Expected Behavior

No response

Steps to Reproduce

Compile with tsc a project using @deck.gl/react.

Our compilation options are (but it's probably irrelevant):

    "compilerOptions": {
        "declaration": true,
        "sourceMap": true,
        "strict": true,
        "noImplicitReturns": true,
        "noImplicitAny": true,
        "noUnusedLocals": true,
        "noUnusedParameters": true,
        "noFallthroughCasesInSwitch": true,
        "noPropertyAccessFromIndexSignature": true,
        "forceConsistentCasingInFileNames": true,
        "module": "es6",
        "moduleResolution": "node",
        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,
        "jsx": "react",
        "target": "es6",
        "allowJs": true,
        "skipLibCheck": true,
        "resolveJsonModule": true,
        "outDir": "./dist"
    },

Environment

  • Framework version: deck.gl@9.2
  • Browser:
  • OS:

Logs

Compilation logs:

@webviz/subsurface-viewer@1.14.2 transpile
tsc --project ./tsconfig.json

../../node_modules/@deck.gl/core/src/controllers/controller.ts:21:24 - error TS7006: Parameter 't' implicitly has an 'any' type.

21 const INERTIA_EASING = t => 1 - (1 - t) * (1 - t);
~

../../node_modules/@deck.gl/core/src/controllers/controller.ts:173:7 - error TS7032: Property 'events' implicitly has type 'any', because its set accessor lacks a parameter type annotation.

173 set events(customEvents) {
~~~~~~

../../node_modules/@deck.gl/core/src/controllers/controller.ts:173:14 - error TS7006: Parameter 'customEvents' implicitly has an 'any' type.

173 set events(customEvents) {
~~~~~~~~~~~~

../../node_modules/@deck.gl/core/src/controllers/controller.ts:338:16 - error TS7006: Parameter 'eventNames' implicitly has an 'any' type.

338 toggleEvents(eventNames, enabled) {
~~~~~~~~~~

../../node_modules/@deck.gl/core/src/controllers/controller.ts:338:28 - error TS7006: Parameter 'enabled' implicitly has an 'any' type.

338 toggleEvents(eventNames, enabled) {
~~~~~~~

../../node_modules/@deck.gl/core/src/controllers/controller.ts:340:26 - error TS7006: Parameter 'eventName' implicitly has an 'any' type.

340 eventNames.forEach(eventName => {
~~~~~~~~~

../../node_modules/@deck.gl/core/src/controllers/controller.ts:484:29 - error TS7006: Parameter 'event' implicitly has an 'any' type.

484 protected _onPanRotateEnd(event): boolean {
~~~~~

../../node_modules/@deck.gl/core/src/controllers/map-controller.ts:406:19 - error TS7006: Parameter 'scale' implicitly has an 'any' type.

406 _zoomFromCenter(scale) {
~~~~~

../../node_modules/@deck.gl/core/src/controllers/map-controller.ts:414:18 - error TS7006: Parameter 'offset' implicitly has an 'any' type.

414 _panFromCenter(offset) {
~~~~~~

../../node_modules/@deck.gl/core/src/controllers/map-controller.ts:422:20 - error TS7006: Parameter 'newProps' implicitly has an 'any' type.

422 _getUpdatedState(newProps): MapState {
~~~~~~~~

../../node_modules/@deck.gl/core/src/controllers/transition-manager.ts:40:24 - error TS7006: Parameter 't' implicitly has an 'any' type.

40 const DEFAULT_EASING = t => t;
~

../../node_modules/@deck.gl/core/src/controllers/transition-manager.ts:209:12 - error TS7006: Parameter 'transition' implicitly has an 'any' type.

209 return transition => {
~~~~~~~~~~

../../node_modules/@deck.gl/core/src/controllers/transition-manager.ts:223:25 - error TS7006: Parameter 'transition' implicitly has an 'any' type.

223 _onTransitionUpdate = transition => {
~~~~~~~~~~

../../node_modules/@deck.gl/core/src/lib/view-manager.ts:161:7 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.

161 viewMap[view.id] = view;
~~~~~~~~~~~~~~~~

../../node_modules/@deck.gl/core/src/lib/view-manager.ts:180:32 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'ViewStateObject'.
No index signature with a parameter of type 'string' was found on type 'ViewStateObject'.

180 const viewState = (view && this.viewState[view.getViewStateId()]) || this.viewState;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../../node_modules/@deck.gl/core/src/lib/view-manager.ts:181:19 - error TS2322: Type 'TransitionProps' is not assignable to type 'ViewStateOf<OneOfViews>'.

181 return view ? view.filterViewState(viewState) : viewState;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../../node_modules/@deck.gl/core/src/lib/view-manager.ts:306:21 - error TS7006: Parameter 'viewState' implicitly has an 'any' type.

306 makeViewport: viewState =>
~~~~~~~~~

../../node_modules/@deck.gl/core/src/transitions/linear-interpolator.ts:81:20 - error TS4111: Property 'around' comes from an index signature, so it must be accessed with ['around'].

81 result.start.around = around;
~~~~~~

../../node_modules/@deck.gl/core/src/transitions/linear-interpolator.ts:85:25 - error TS4111: Property 'width' comes from an index signature, so it must be accessed with ['width'].

85 width: endProps.width,
~~~~~

../../node_modules/@deck.gl/core/src/transitions/linear-interpolator.ts:86:26 - error TS4111: Property 'height' comes from an index signature, so it must be accessed with ['height'].

86 height: endProps.height
~~~~~~

../../node_modules/@deck.gl/core/src/transitions/linear-interpolator.ts:100:7 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.

100 propsInTransition[key] = lerp(startProps[key] || 0, endProps[key] || 0, t);
~~~~~~~~~~~~~~~~~~~~~~

../../node_modules/@deck.gl/core/src/transitions/transition-interpolator.ts:66:9 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.

66 startViewStateProps[key] = startProps[key];
~~~~~~~~~~~~~~~~~~~~~~~~

../../node_modules/@deck.gl/core/src/transitions/transition-interpolator.ts:67:9 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.

67 endViewStateProps[key] = endProps[key];
~~~~~~~~~~~~~~~~~~~~~~

../../node_modules/@deck.gl/core/src/transitions/transition-interpolator.ts:96:15 - error TS6133: 'startProps' is declared but its value is never read.

96 getDuration(startProps: Record<string, any>, endProps: Record<string, any>): number {
~~~~~~~~~~

../../node_modules/@deck.gl/core/src/transitions/transition-interpolator.ts:97:21 - error TS4111: Property 'transitionDuration' comes from an index signature, so it must be accessed with ['transitionDuration'].

97 return endProps.transitionDuration;
~~~~~~~~~~~~~~~~~~

../../node_modules/@deck.gl/core/src/transitions/transition-interpolator.ts:100:23 - error TS7006: Parameter 'props' implicitly has an 'any' type.

100 _checkRequiredProps(props) {
~~~~~

../../node_modules/@deck.gl/core/src/types/types.ts:10:8 - error TS7019: Rest parameter 'args' implicitly has an 'any[]' type.

10 new (...args): T;
~~~~~~~

../../node_modules/@deck.gl/core/src/utils/flatten.ts:44:28 - error TS7031: Binding element 'target' implicitly has an 'any' type.

44 export function fillArray({target, source, start = 0, count = 1}) {
~~~~~~

../../node_modules/@deck.gl/core/src/utils/flatten.ts:44:36 - error TS7031: Binding element 'source' implicitly has an 'any' type.

44 export function fillArray({target, source, start = 0, count = 1}) {
~~~~~~

../../node_modules/@deck.gl/core/src/utils/math-utils.ts:100:5 - error TS7034: Variable 'scratchArray' implicitly has type 'any' in some locations where its type cannot be determined.

100 let scratchArray;
~~~~~~~~~~~~

../../node_modules/@deck.gl/core/src/utils/math-utils.ts:121:45 - error TS7005: Variable 'scratchArray' implicitly has an 'any' type.

121 scratchArray = typedArrayManager.allocate(scratchArray, count, {
~~~~~~~~~~~~

../../node_modules/@deck.gl/core/src/utils/positions.ts:21:5 - error TS7029: Fallthrough case in switch.

21 case 'string':
~~~~~~~~~~~~~~

../../node_modules/@deck.gl/core/src/viewports/viewport.ts:392:29 - error TS4111: Property 'near' comes from an index signature, so it must be accessed with ['near'].

392 if (this._frustumPlanes.near) {
~~~~

../../node_modules/@deck.gl/core/src/viewports/viewport.ts:413:17 - error TS6133: 'coords' is declared but its value is never read.

413 panByPosition(coords: number[], pixel: number[]): any {
~~~~~~

../../node_modules/@deck.gl/core/src/viewports/viewport.ts:413:35 - error TS6133: 'pixel' is declared but its value is never read.

413 panByPosition(coords: number[], pixel: number[]): any {
~~~~~

../../node_modules/@deck.gl/core/src/views/view.ts:155:11 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'TransitionProps'.
No index signature with a parameter of type 'string' was found on type 'TransitionProps'.

155 newViewState[key] = this.props.viewState[key];
~~~~~~~~~~~~~~~~~

../../node_modules/@deck.gl/core/src/views/view.ts:155:31 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ id?: string | undefined; } & Partial'.
No index signature with a parameter of type 'string' was found on type '{ id?: string | undefined; } & Partial'.

155 newViewState[key] = this.props.viewState[key];
~~~~~~~~~~~~~~~~~~~~~~~~~

Found 37 errors in 12 files.

Errors Files
7 ../../node_modules/@deck.gl/core/src/controllers/controller.ts:21
3 ../../node_modules/@deck.gl/core/src/controllers/map-controller.ts:406
3 ../../node_modules/@deck.gl/core/src/controllers/transition-manager.ts:40
4 ../../node_modules/@deck.gl/core/src/lib/view-manager.ts:161
4 ../../node_modules/@deck.gl/core/src/transitions/linear-interpolator.ts:81
5 ../../node_modules/@deck.gl/core/src/transitions/transition-interpolator.ts:66
1 ../../node_modules/@deck.gl/core/src/types/types.ts:10
2 ../../node_modules/@deck.gl/core/src/utils/flatten.ts:44
2 ../../node_modules/@deck.gl/core/src/utils/math-utils.ts:100
1 ../../node_modules/@deck.gl/core/src/utils/positions.ts:21
3 ../../node_modules/@deck.gl/core/src/viewports/viewport.ts:392
2 ../../node_modules/@deck.gl/core/src/views/view.ts:155
npm error Lifecycle script transpile failed with error:
npm error code 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions