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
thrownewError(`No valid runtime type for ${stringifyValueWithType(object)} given. Is @deepkit/type-compiler correctly installed? Execute deepkit-type-install to check`);
@SamJakob had a great idea about improving this error message. Quote from discord:
Totally - I love the way Flutter does it’s error messages, they basically explain the issue in a fair bit of detail and then provide tips on how to fix it.
So for example you could have a helper function that detects if reflection is set in tsconfig.json and explains to the user that it’s not set and what it needs to be set for (in a fairly general way in case it’s a peer dependency in another framework like yours or mine) and that the user has to set it.
And then similarly for detecting if the typescript copy is patched
it's not always possible to detect tsconfig.json options or paths (since they might be provided by a build tool, or when run in the browser), but we could describe in a general way what needs to be enabled. And if the code runs in the server maybe try to check if there is a tsconfig.json and just read that file (works for beginners well enough that have likely a single tsconfig.json)
The text was updated successfully, but these errors were encountered:
Also, when reflection is not set to true in tsconfig.json, the following error is returned (in this case when testing with valuesOf):
deepkit-framework/packages/type/src/reflection/reflection.ts:136
throw new Error('No type given');
^
Error: No type given
at typeOf (deepkit-framework/packages/type/src/reflection/reflection.ts:136:11)
at valuesOf (deepkit-framework/packages/type/src/reflection/reflection.ts:98:18)
at Object.<anonymous> (deepkit-test/src/main.ts:41:21)
at Module._compile (node:internal/modules/cjs/loader:1233:14)
at Module.m._compile (deepkit-test/node_modules/ts-node/src/index.ts:1618:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
at Object.require.extensions.<computed> [as .ts] (deepkit-test/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Function.Module._load (node:internal/modules/cjs/loader:938:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
Edit: this might be specific to valuesOf (and/or typeOf) in any case
deepkit-framework/packages/type/src/reflection/processor.ts
Line 363 in 92315f9
@SamJakob had a great idea about improving this error message. Quote from discord:
it's not always possible to detect tsconfig.json options or paths (since they might be provided by a build tool, or when run in the browser), but we could describe in a general way what needs to be enabled. And if the code runs in the server maybe try to check if there is a tsconfig.json and just read that file (works for beginners well enough that have likely a single tsconfig.json)
The text was updated successfully, but these errors were encountered: