okta/okta-sdk-nodejs

tsc type checking fails for importsNotUsedAsValues and isolatedModules

MayaLi opened this issue · 3 comments

Current behavior

I updated our dependency from okta/okta-sdk-nodejs to v6.3.0 from v5 in our project dependency. Running npx tsc --noEmit in my project returns type check errors

[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/parameterized-operations-client.ts(2,1): error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/parameterized-operations-client.ts(3,1): error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/parameterized-operations-client.ts(4,1): error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/parameterized-operations-client.ts(5,1): error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/parameterized-operations-client.ts(6,1): error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/parameterized-operations-client.ts(7,1): error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/parameterized-operations-client.ts(8,1): error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/parameterized-operations-client.ts(9,1): error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/parameterized-operations-client.ts(10,1): error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/parameterized-operations-client.ts(11,1): error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/parameterized-operations-client.ts(26,3): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/request-options/SecurePasswordStoreApplicationOptions.ts(34,3): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
[2022-02-16T02:36:36.430Z] 	node_modules/@okta/okta-sdk-nodejs/src/types/request-options/SwaApplicationOptions.ts(30,3): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.

Our tsconfig.json is as follows:

{
  "ts-node": {
    "transpileOnly": true
  },
  "compilerOptions": {
    "rootDir": ".",
    "baseUrl": ".",
    "target": "es2021",
    "module": "commonjs",
    "lib": ["es2021"],
    "outDir": "build",
    "checkJs": false,
    "allowJs": true,
    "strict": true,
    "alwaysStrict": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "sourceMap": true,
    "inlineSources": true,
    "resolveJsonModule": true,
    "noImplicitAny": true,
    "noErrorTruncation": false,
    "isolatedModules": true,
    "importsNotUsedAsValues": "error",
    "useUnknownInCatchVariables": false,
    "skipLibCheck": true
  },
  "include": [
    "app/**/*.ts",
    "app/**/*.js",
    "scripts/**/*.ts",
    "config/*.ts",
    "app/test/_global_hooks.ts"
  ],
  "exclude": ["node_modules"]
}

Expected behavior

No type check errors

Minimal reproduction of the problem with instructions

  1. In a TS node project using using npm npm install --save @okta/okta-sdk-nodejs@6.3.0
  2. Add tsconfig.json as one shown above
  3. run npx tsc --noEmit

Environment

  • OS: mac, linux
  • Node.js version: v16.14.0
  • Other: npm: '8.3.1'

@MayaLi Thanks for reporting this issue. There should be no typescript errors. We will look into this and see what is going wrong.

Thank you very much for the speedy resolution @oleksandrpravosudko-okta