You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type-compiler could not serialize this kind of legit typescript types:
export type Option<T> = OptionType<T>;
class OptionType<T> {
constructor(val: T, some: boolean) {}
}
export function Option<T>(val: T): Option<T> {
return new OptionType(val, true);
};
const value: Option<string> = Option('hello');
In that case Option is both type alias to OptionType class, and a function that calls for new OptionType.
It compiles successfully with default tsc, but type-compiler breaks this functionality.
RangeError: Maximum call stack size exceeded
at findVariable (deepkit-example/node_modules/@deepkit/type-compiler/dist/cjs/src/compiler.js:119:22)
at findVariable (deepkit-example/node_modules/@deepkit/type-compiler/dist/cjs/src/compiler.js:125:16)
at findVariable (deepkit-example/node_modules/@deepkit/type-compiler/dist/cjs/src/compiler.js:125:16)
This happens because of type-compiler loops between FunctionDeclaration and TypeReference.
One of possible solution is to add some nodes memorizing, and limit maximum depth for iterating over same nodes, as TypeScript does.
The text was updated successfully, but these errors were encountered:
type-compiler could not serialize this kind of legit typescript types:
In that case
Option
is both type alias toOptionType
class, and a function that calls fornew OptionType
.It compiles successfully with default tsc, but type-compiler breaks this functionality.
This happens because of type-compiler loops between FunctionDeclaration and TypeReference.
One of possible solution is to add some nodes memorizing, and limit maximum depth for iterating over same nodes, as TypeScript does.
The text was updated successfully, but these errors were encountered: