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

Unable to build project using this package in TypeScript strict mode #10

Open
half0wl opened this issue Oct 13, 2023 · 7 comments
Open

Comments

@half0wl
Copy link

half0wl commented Oct 13, 2023

  1. Have strict=true in tsconfig
  2. Build project
  3. Receive error:
    ./node_modules/typeid-ts/src/lib/basics.ts:6:5
    Type error: Variable 'uuidv7' implicitly has type 'any' in some locations where its type cannot be determined.
    
      4 | import { encode } from '../base32.js'
      5 |
    > 6 | let uuidv7
        |     ^
      7 | (async () => {
      8 |   const mod = await import('uuidv7')
      9 |   uuidv7 = mod.uuidv7
    error Command failed with exit code 1.
    

On v0.3.1, seems related to #7

@ongteckwu
Copy link
Owner

ok new build. Try again. Tq

@benjick
Copy link

benjick commented Oct 14, 2023

I'm getting something similar on 0.3.1 when building my nextjs project, when I have strict=true:

./node_modules/typeid-ts/src/base32.ts:17:5
Type error: Type 'number | undefined' is not assignable to type 'number'.
  Type 'undefined' is not assignable to type 'number'.

  15 |
  16 |     // 10 byte timestamp
> 17 |     buffer[0] = alphabet[(src[0] & 224) >> 5]
     |     ^
  18 |     buffer[1] = alphabet[src[0] & 31]
  19 |     buffer[2] = alphabet[(src[1] & 248) >> 3]
  20 |     buffer[3] = alphabet[((src[1] & 7) << 2) | ((src[2] & 192) >> 6)]
error: script "build" exited with code 1 (SIGHUP)

@ongteckwu
Copy link
Owner

ok fixed try again ben

@benjick
Copy link

benjick commented Oct 15, 2023

Hey @ongteckwu, thanks for the quick reply. Sadly I still get an error on 0.3.7. I'm using NextJS btw

./node_modules/typeid-ts/src/base32.ts:31:5
Type error: Type 'number | undefined' is not assignable to type 'number'.
  Type 'undefined' is not assignable to type 'number'.

  29 |
  30 |     // 10 byte timestamp
> 31 |     buffer[0] = alphabet[(src[0] & 224) >> 5]
     |     ^
  32 |     buffer[1] = alphabet[src[0] & 31]
  33 |     buffer[2] = alphabet[(src[1] & 248) >> 3]
  34 |     buffer[3] = alphabet[((src[1] & 7) << 2) | ((src[2] & 192) >> 6)]
error: script "build" exited with code 1 (SIGHUP)

@ongteckwu
Copy link
Owner

ok pushed a new one, hope this works. If not will really need you to raise a PR instead.

@benjick
Copy link

benjick commented Oct 16, 2023

It worked! 🙏 thank you @ongteckwu!

@nadilas
Copy link

nadilas commented Oct 19, 2023

@benjick Is 0.3.8 the version that should be working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants