The current type declarations aren't compatible with TypeScript 4.x
Closed this issue · 1 comments
mscharley commented
Describe the bug.
> tsc
node_modules/@mscharley/dot/dot.d.ts:419:74 - error TS2552: Cannot find name 'ClassDecoratorContext'. Did you mean 'ClassDecorator'?
419 <T extends object>(target: interfaces.Constructor<T, Args>, context: ClassDecoratorContext<interfaces.Constructor<T, Args>>): undefined;
~~~~~~~~~~~~~~~~~~~~~
node_modules/@mscharley/dot/dot.d.ts:433:34 - error TS2304: Cannot find name 'ClassFieldDecoratorContext'.
433 (target: undefined, context: ClassFieldDecoratorContext<unknown, T>): (originalValue: T | undefined) => T;
~~~~~~~~~~~~~~~~~~~~~~~~~~
The types used for ClassDecoratorContext
and the other types related to TC39 decorators are only available in TypeScript 5.0 and later.
Steps to reproduce
Try to install in a project which is still using TypeScript 4.
Expected behaviour
No response
DOT
1.4.2
TypeScript
4.9.3
Decorator type
TC39
Node
16
Add any other context about the problem here.
No response
mscharley commented
{
"type": "module",
"exports": {
".": {
"require":
"types@<5.0": "./dot.v4.d.ts",
"types": "./dot.d.ts",
"default": "./dot.cjs"
},
"import": {
"types@<5.0": "./dot.v4.d.ts",
"types": "./dot.d.ts",
"default": "./dot.js"
}
}
}
}
dot.v4.d.ts
can be generated by using grep to exclude every line containing DecoratorContext
. This should be a fairly solid way to deal with it since we only need to exclude certain call signatures out of the decorator type definitions.