Oh thank God. There aren't nearly enough ways to write javascript.
There's no Javascript (or any other runtime) code in this at all. It all happens at compile-time.
HypeScript: Simplified TypeScript type system in TypeScript's own type system
21–30 of 84 posts
Re: HypeScript: Simplified TypeScript type system in TypeScript's own type system
#22“I'm not about to start using it for real projects, it's really just a thought experiment about how nice JavaScript could be with an alternative syntax.” - jashkenas 2009 https://news.ycombinator.com/item?id=1014225
Re: HypeScript: Simplified TypeScript type system in TypeScript's own type system
#23Re: HypeScript: Simplified TypeScript type system in TypeScript's own type system
#24Re: HypeScript: Simplified TypeScript type system in TypeScript's own type system
#25Maybe "dependent-but-stringly typed" is possible?
Re: HypeScript: Simplified TypeScript type system in TypeScript's own type system
#26Re: HypeScript: Simplified TypeScript type system in TypeScript's own type system
#27Re: HypeScript: Simplified TypeScript type system in TypeScript's own type system
#28Am I the only one that feels uncomfortable with all that usage of strings in TS’s type system? Why not use pure literals instead of string literals? This is a genuine question, I’m trying to find out what the pros and cons where in the decision making process.
The bigger reason why it is this way is to ensure you can write type annotations for stringly-typed Javascript. While Typescript is it's own thing really at this point, it still is very focused on making it possible to type-annotate JS code.
type Event = 'onClick' | 'onHover'
// some stringly typed javascript can now be nicely typed
something.triggerEvent('onClick', someData)
It lets you do some really nice things, and is quite strongly typed despite how it looks at first glace, while still letting me write some strongly-typed definitions for existing Javascript code that was very much __not__ written with types in mind.Re: HypeScript: Simplified TypeScript type system in TypeScript's own type system
#29I do really wish TS had actual inbuilt reflective type checking along the lines of this: https://github.com/Hookyns/tst-reflect ...I can hazily see some kind of monstrosity that could come from linking these things together hah