multiformats / multiformats/js-multiformats
Typescript compile fails with errors in cid.d.ts
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 268
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Description
This package got included in my project via atproto.
When trying to compile typescript (npx tsc) using
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"skipLibCheck": false
It fails with two errors
node_modules/multiformats/types/src/cid.d.ts:160:85 - error TS2344: Type 'Prefix' does not satisfy the constraint 'string'.
160 export type MultibaseEncoder<Prefix> = import('./bases/interface').MultibaseEncoder<Prefix>;
~~~~~~
node_modules/multiformats/types/src/cid.d.ts:160:30
160 export type MultibaseEncoder<Prefix> = import('./bases/interface').MultibaseEncoder<Prefix>;
~~~~~~
This type parameter might need an `extends string` constraint.
node_modules/multiformats/types/src/cid.d.ts:161:85 - error TS2344: Type 'Prefix' does not satisfy the constraint 'string'.
161 export type MultibaseDecoder<Prefix> = import('./bases/interface').MultibaseDecoder<Prefix>;
~~~~~~
node_modules/multiformats/types/src/cid.d.ts:161:30
161 export type MultibaseDecoder<Prefix> = import('./bases/interface').MultibaseDecoder<Prefix>;
~~~~~~
This type parameter might need an `extends string` constraint.
replacing
export type MultibaseEncoder<Prefix > = import('./bases/interface').MultibaseEncoder<Prefix>;
export type MultibaseDecoder<Prefix> = import('./bases/interface').MultibaseDecoder<Prefix>;
with
export type MultibaseEncoder<Prefix extends string> = import('./bases/interface').MultibaseEncoder<Prefix>;
export type MultibaseDecoder<Prefix extends string> = import('./bases/interface').MultibaseDecoder<Prefix>;
removes the error. but I have no idea what it means ... or where this is generated :-)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with node_modules/multiformats/types/src/cid.d.ts and the referenced ./bases/interface declaration to trace where the failing type aliases are generated. Reproduce the issue with npx tsc using the configuration in the report, then verify that the package's generated declarations compile without the two TS2344 errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100