arquero icon indicating copy to clipboard operation
arquero copied to clipboard

Problems getting Arquero to find it's types in Typescript

Open mishatsvelik opened this issue 2 years ago • 3 comments

I keep on getting messages like this, suggesting that arquero cannot find it's type declarations:

node_modules/arquero/dist/types/op/window-functions.d.ts:25:35 - error TS2304: Cannot find name 'WindowState'.

25 export type WindowValue = (state: WindowState) => any; ~~~~~~~~~~~

node_modules/arquero/dist/types/op/window-functions.d.ts:33:11 - error TS2304: Cannot find name 'AggregateInit'.

33 init: AggregateInit; ~~~~~~~~~~~~~

mishatsvelik avatar Jul 06 '23 08:07 mishatsvelik

To reproduce this:

  1. Installed arquero to my Typescript project through the CLI: npm install arquero --save
  2. Added import * as aq from 'arquero' to index.ts
  3. Then if you go to node_modules/arquero/dist/types/op/window-functions.d.ts can see WindowState is highlighted red: type WindowState = /*unresolved*/ any

mishatsvelik avatar Jul 06 '23 22:07 mishatsvelik

This is happening in Angular 17 as well

X [ERROR] TS2304: Cannot find name 'WindowState'. [plugin angular-compiler]

node_modules/arquero/dist/types/op/window-functions.d.ts:25:34:
  25 │ export type WindowValue = (state: WindowState) => any;
     ╵                                   ~~~~~~~~~~~

tsconfig.json is

/* To learn more about this file see: https://angular.io/config/tsconfig. */ { "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "esModuleInterop": true, "sourceMap": true, "declaration": false, "experimentalDecorators": true, "moduleResolution": "node", "importHelpers": true, "target": "ES2022", "module": "ES2022", "useDefineForClassFields": false, "lib": [ "ES2022", "dom" ] }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, "strictInputAccessModifiers": true, "strictTemplates": true } }

coreboarder avatar Nov 19 '23 00:11 coreboarder

The bolded change appears to have fixed the issue for me.

{ "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "esModuleInterop": true, "sourceMap": true, "declaration": false, "experimentalDecorators": true, "moduleResolution": "node", "importHelpers": true, "target": "ES2022", "module": "ES2022", "useDefineForClassFields": false, "lib": [ "ES2022", "dom" ], "skipLibCheck": true }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, "strictInputAccessModifiers": true, "strictTemplates": true } }

coreboarder avatar Nov 19 '23 01:11 coreboarder

I'd like to point out that the above bolded change isn't really a fix. It's basically just a way to ignore type errors that Typescript would otherwise report. This is a library that we are trying to uptake, but we are not interested in turning on skipLibCheck, so I'd be interested in an actual solution.

atmgrifter00 avatar Mar 12 '24 18:03 atmgrifter00

Looks like #346 may address this issue

rajsite avatar Mar 20 '24 16:03 rajsite