Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error #119

Closed
thomasvargiu opened this issue Nov 26, 2020 · 8 comments
Closed

Compile error #119

thomasvargiu opened this issue Nov 26, 2020 · 8 comments
Labels
invalid This doesn't seem right triage wontfix This will not be worked on

Comments

@thomasvargiu
Copy link

Using this library, on compiling it use my  tsconfig to compile the library,
So I can't compile it because of some errors:

node_modules/jose/src/jwk/parse.ts:80:5 - error TS7029: Fallthrough case in switch.

80     case 'RSA':
       ~~~~~~~~~~~


Found 1 error.

Even more if I enable the new TS flag noUncheckedIndexedAccess.

@panva
Copy link
Owner

panva commented Nov 26, 2020

Providing no reproduction gist or project. 👎 Please use the bug issue templates maintainers prepare.

Anyway.


https://github.com/panva/jose/blob/v3.1.2/src/jwk/parse.ts#L80-L88

I don't see a bug. This fallthrough is intended. Don't get why you'd compile a dependency library when it comes with already prepared dist folder that's tested.

https://www.typescriptlang.org/tsconfig#skipLibCheck

@panva panva closed this as completed Nov 26, 2020
@panva panva added invalid This doesn't seem right wontfix This will not be worked on labels Nov 26, 2020
@thomasvargiu
Copy link
Author

@panva I'm just using it as the README says:

import jwtVerify, { JWTPayload } from 'jose/jwt/verify';

/// my code

Nothing more.

skipLibCheck it's enabled, but just works for the *.d.ts. I don't know which is the problem.

My tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "outDir": "./dist",
    "strict": true, 
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "noUncheckedIndexedAccess": true,
    "baseUrl": "./",
    "typeRoots": [
        "./src/@types",
        "./node_modules/@types"
    ],
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "exclude": [
    "node_modules",
    "./src/@types"
  ]
}

@panva
Copy link
Owner

panva commented Nov 26, 2020

I can reproduce but have no clue why TS does any checking inside a library source. Anyway, i suspect using the actual source files might be an issue so i'll instead compile the type declarations only and publish those. Not sure if it'll help but it'll at least bring the install size down a bit.

@thomasvargiu
Copy link
Author

BTW, I noticed that current types*.d.ts does not include a lot of interfaces (es: createRemoteJWKSet, JOSEError, etc...).

@panva
Copy link
Owner

panva commented Nov 26, 2020

that's because they're resolved from the source files

panva added a commit that referenced this issue Nov 26, 2020
@panva
Copy link
Owner

panva commented Nov 26, 2020

I've published v3.1.3 in which the source files are not published to serve as type definitions anymore. Instead the ts source files are used to compile just .d.ts files with comments serving as inline docs. 💩 typescript.

@thomasvargiu
Copy link
Author

It works! Thanks!

@panva
Copy link
Owner

panva commented Nov 26, 2020

Please consider supporting the library if it provides value to you or your company and this support was of help to you. Supporting the library means, amongst other things, that such support will be available in the future.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right triage wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants