... and not a normal dependency. That is the first thing, i'm wondering.
The docs say:
The type information is emitted using reflect-metadata. You'll need to import it as early in your application as
possible and ensure that it is imported only once.
So there must be some reason behind it i assume. That's fine. But please in case of a peer dependency, there should be a better error message, when it was forgotten by the user. A forgotten
import 'reflect-metadata' in my testcase, gives me a
TypeError: Reflect.hasMetadata is not a function
at getFlags (node_modules/typescript-rtti/src/lib/reflect.ts:1828:18)
at Function.for (node_modules/typescript-rtti/src/lib/reflect.ts:1906:21)
at ReflectedClassRef.matchesValue (node_modules/typescript-rtti/src/lib/reflect.ts:449:34)
at Object.<anonymous> (pythagora_tests/unit/matchesValueLib/matchesValue.test.ts:23:45)
And this is just a bad dev experience cause one has no clue and costed me some hours even as an experienced typescript-rtti user.
So you should, before every usage, make a check with a friendly error message like:
if(!Reflect) {
throw new Error("Package 'reflect-metadata' is not included. Please do an "import 'reflect-metadata'" as early as possible in your application");
}
Thanks for an improvement ;)
... and not a normal dependency. That is the first thing, i'm wondering.
The docs say:
So there must be some reason behind it i assume. That's fine. But please in case of a peer dependency, there should be a better error message, when it was forgotten by the user. A forgotten
import 'reflect-metadata'in my testcase, gives me aAnd this is just a bad dev experience cause one has no clue and costed me some hours even as an experienced typescript-rtti user.
So you should, before every usage, make a check with a friendly error message like:
Thanks for an improvement ;)