[BUG] type metadata
See original GitHub issueDescribe the bug
Type introspection doesn’t seem to work on types extending other types. Also, since types don’t support decorators (i.e. @reflected), one has to manually write getType<TypeA>() in order to activate metadata generation for TypeA. Without this, the result contains invalid values, like “type.name : ‘unknown’”
The code causing the problem
type TypeA = {
prop1: string
}
type TypeB = TypeA & {
prop2: string,
prop3: string
}
const t0: Type = getType<TypeA>();
const t1: Type = getType<TypeB>();
console.log(t1.getProperties())
To Reproduce Steps to reproduce the behavior:
- Build,
- run,
- see error…
Expected behavior
All properties including inherited ones should be displayed by console.log(t1.getProperties())
Runtime (please complete the following information):
- Node.js version: v18.10.0
- TypeScript version: 4.8.4
- Compiler: [ttypescript]
- Bundler: [none]
Additional context
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Automatically capture custom metadata inside your bug reports
We can now give your developers the ability to pass custom metadata to your Marker.io script, which is then forwarded into each bug...
Read more >An example of metadata from a bug report - ResearchGate
Locating relevant source files for a given bug report is an important task in software development and maintenance. To make the locating process...
Read more >Other Bug Metadata — Firefox Source Docs documentation
Quick search · Bug Handling · Other Bug Metadata · Report an issue / View page source ...
Read more >Predicting code bug risk with git metadata | by Civis Analytics
We need to use both types of metadata for our bug risk prediction tool, fortunately, git makes it easy to get at this...
Read more >Finding Bugs in Source Code Using Commonly ... - USENIX
This paper provides a method for leveraging development metadata to find bugs that would otherwise be difficult to find using standard static analy-...
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
Looking forward to it! And thanks for this awesome lib, makes a difference for my use case!
Okay, got it.
Sadly, this is intended behavior in the current version. This was intended as an optimisation, so only required types are reflected because of size of metadata (it would be megabytes for some projects). Type.find() was introduced later, but it is limited to reflected types.
New major version (alpha release is rly close) works in a different way (based on include/exclude options) so it works properly there.