ts-node breaks Date reflection mechanism
See original GitHub issueimport "reflect-metadata";
const CollectMetadata: PropertyDecorator = (target, propertyKey) => {
const ReflectType = Reflect.getMetadata("design:type", target, propertyKey);
console.log(ReflectType);
console.log(ReflectType === Date);
}
class Test {
@CollectMetadata
property: Date;
}
ts-node output:
PS E:\#Programowanie\#GitHub\type-graphql> npx ts-node src/date.ts
E:\#Programowanie\#GitHub\type-graphql\node_modules\ts-node\dist\bin.js
[Function: Object]
false
tsc and node output:
PS E:\#Programowanie\#GitHub\type-graphql> npx tsc; node build/date.js
E:\#Programowanie\#GitHub\type-graphql\node_modules\typescript\bin\tsc
[Function: Date]
true
I have no idea what’s going on, how can we check the emitted js files?
I’m using ts-node 4.1.0 😉
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Methods for TypeScript runtime type checking - LogRocket Blog
Explore five methods of performing TypeScript type checks at runtime in this post and learn each of their advantages and disadvantages.
Read more >ts-node-dev doesn't apply changes in auto reload
says that the server has restarted when a typescript file is changed, the change is not applyed.
Read more >Safari Technology Preview Release Notes - Apple Developer
Fixed non-breaking space getting inserted instead of a normal space character between ... Changed to grayscale nodes in the DOM tree that are...
Read more >Reflection in Typescript - Sergey Radzishevskii - Medium
Languages like C#, Java, PHP have a reflection mechanism. Reflection is a feature in the Java programming language.
Read more >Release Notes — Airflow Documentation
Logical date of a DAG run triggered from the web UI now have its sub-second component set to zero¶. Due to a change...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’ve tested it and every single reflection works (classes from external files, String, Number, Boolean, etc.), only the
Dateis reflected asObjectin this mode. That’s why it’s weird, should we bump the question to the TS team?👍 I’ve also encountered this issue