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
Interface is a useful tool in TypeScript, but sometimes we'll need to write two pieces of almost identical code for intellisense and functionality respectively.
Is it acceptable to add a simple statement for generating part of interface information (properties)?
Kagami Sascha Rosylight (@saschanaz) yeah, later I found that I misunderstood what you said... T-T my head is full of coffee, and it's too heavy to think...
Hmm, I thought it was easy because it seemed like we only need to do some sort of traversing... But I still look forward to it, annotations are annoying and it's not how JSers code. Any way we just need the certain reflection generated when reflect is there, and it should be somewhat compile-time...
👍 I also think that it would be great to be able to access interfaces via reflection. Though I don't need that level of detail. The name of the interfaces would be enough.
Unfortunately tscompiler-reflect project is discontinued. Is there any way to get runtime type check in TypeScript? RTTC was one of the main design goals of AtScript.
+1. I really hope to see typescript supports Java like reflection which is very useful for metadata driven designs such as use type information to generate auto-completion UI. The type information is valuable information which shouldn't be erased at runtime.
+1. This is a must have feature in any grown up language. One cannot be expected to rewrite all the types of an interface over again just to check the type.
The "keyof" and "reflect" is not the same! This has type information and can probably be usefull e.g in Angular2 Dependency Injection, injecting Interfaces.
We can have both or at least "reflect" that is more generic with.
Activity
saschanaz commentedon Dec 24, 2014
This will help my ObjectExtensions.ensure library a lot.
vilicvane commentedon Dec 24, 2014
Kagami Sascha Rosylight (@saschanaz) oops. sorry I din't read the comment carefully.
saschanaz commentedon Dec 24, 2014
vilic No, I didn't suggest anything but just said that I like your suggestion.
This will be much better than:
vilicvane commentedon Dec 24, 2014
Kagami Sascha Rosylight (@saschanaz) yeah, later I found that I misunderstood what you said... T-T my head is full of coffee, and it's too heavy to think...
saschanaz commentedon Dec 24, 2014
vilic Haha, me too. It's 1:44 AM here and I feel I have to sleep now. Well... Merry Christmas (or merry Christmas eve) 😄
vilicvane commentedon Dec 24, 2014
Kagami Sascha Rosylight (@saschanaz) lol, Merry Christmas, and good night~ :D
danquirk commentedon Jan 6, 2015
Run time type information (ie reflection) is currently outside our design goals (https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals). If we were to do something like what you're requesting it would most likely surface in the form of attributes like #1557
vilicvane commentedon Jan 6, 2015
Hmm, I thought it was easy because it seemed like we only need to do some sort of traversing... But I still look forward to it, annotations are annoying and it's not how JSers code. Any way we just need the certain reflection generated when
reflectis there, and it should be somewhat compile-time...saschanaz commentedon Jan 6, 2015
We don't need:
but we do need:
and this should be able to be done on compile-time.
ipy commentedon Feb 1, 2015
+1 for this feature. It will be of great help to deal with POJO ajax data and convert their types.
meirgottlieb commentedon Feb 3, 2015
Take a look at this project: https://github.com/artifacthealth/tsreflect-compiler.
vilicvane commentedon Feb 4, 2015
Meir Gottlieb (@meirgottlieb) that is great but I guess it won't fit the needs. :'(
remojansen commentedon May 14, 2015
👍 I also think that it would be great to be able to access interfaces via reflection. Though I don't need that level of detail. The name of the interfaces would be enough.
#3148
electricmonk commentedon Dec 2, 2015
+1, would be very useful for stubbing interfaces, a-la Mockito (http://mockito.org/), something like:
typeofweb commentedon Feb 29, 2016
Unfortunately tscompiler-reflect project is discontinued. Is there any way to get runtime type check in TypeScript? RTTC was one of the main design goals of AtScript.
jianwu commentedon Mar 31, 2016
+1. I really hope to see typescript supports Java like reflection which is very useful for metadata driven designs such as use type information to generate auto-completion UI. The type information is valuable information which shouldn't be erased at runtime.
blue112 commentedon Jul 21, 2016
+1. This is a must have feature in any grown up language. One cannot be expected to rewrite all the types of an interface over again just to check the type.
shumy commentedon Feb 1, 2017
The "keyof" and "reflect" is not the same! This has type information and can probably be usefull e.g in Angular2 Dependency Injection, injecting Interfaces.
We can have both or at least "reflect" that is more generic with.