Because of somewhat eager
|
const typeToTest = typeThunk?.(); |
it's currently impossible to define types
truly lazily.
Above call causes serious problems when ES modules are being used.
To reproduce, you can review and
git clone https://github.com/perceptron8/TypedJSONReferenceError
cd TypedJSONReferenceError
yarn install
yarn test
-> ReferenceError: Cannot access 'A' before initialization.
"emitDecoratorMetadata" (tsconfig.json) is deliberately set to false, so it's not because of microsoft/TypeScript#4521.
If you change "type" to "commonjs" (package.json) and "compilerOptions" / "module" to "CommonJS" (tsconfig.json), test will run fine. BTW that's exactly why your lazy-types.spec.ts isn't failing:
I know that typeToTest is currently being used to check for special property types, but maybe this checking could be deferred or - in case of jsonMemberDecoratorFactory - skipped at all?
This issue refers to: #139.
Because of somewhat eager
TypedJSON/src/json-member.ts
Line 195 in 6f886ae
it's currently impossible to define types truly lazily.
Above call causes serious problems when ES modules are being used.
To reproduce, you can review and
->
ReferenceError: Cannot access 'A' before initialization."emitDecoratorMetadata" (tsconfig.json) is deliberately set to false, so it's not because of microsoft/TypeScript#4521.
If you change "type" to "commonjs" (package.json) and "compilerOptions" / "module" to "CommonJS" (tsconfig.json), test will run fine. BTW that's exactly why your lazy-types.spec.ts isn't failing:
TypedJSON/tsconfig/tsconfig.spec.json
Line 4 in 6f886ae
I know that
typeToTestis currently being used to check for special property types, but maybe this checking could be deferred or - in case ofjsonMemberDecoratorFactory- skipped at all?This issue refers to: #139.