JS Variable$Types vs. Variable : Types

Thanks, those looks like great places to discuss this too.

My #1 goal is a standard simple way to denote types in JS that works with JavaScripts strengths of allowing any types. That's why I'm here at TC39.

Please imagine if JS added Types how that could then look in standardized JSON stringified data. Typed JSON and JS would be revolutionary for Web Authors! Imagine how incredible it would be for a standard to add completely optional semantic Type information to JS programming data. Think of the Semantic Web and 1990s Web 3.0 dreams.

Typed Comments are a great option for TS Devs to get all their Types into JS comments care free.

Typed Names are an even better option for JS Devs to get all their Types into JS variable data.

We have been finding endless examples of how common, helpful, and standard it is already to store Type info in a Name. We all do it!

Both those goals you mentioned don't have to make TS in conflict with JS. We can handle this in a way that is 100% respectful to TS devs and TS devs who don't want to Type their Variables in JS are not forced.

JS Metaprogramming is a huge subject. TS Metaprogramming cannot be what limits JS Metaprogramming.

This is a variation of hungarian notation?

see Hungarian notation - Wikipedia

1 Like

It seems similar - in my background research I also found Hungarian Notation too.

I feel the File Name and File Type metaphore is the most relatable and understandable because every person on Earth knows what a File Type is. A file and a JS variable can be anything.

Imagine if we didn't use filetypes. Instead you must just use a name to remember what everything on your computer is. It's an incredibly convenient and helpful concept to know the Type of program data. Immutable typing in JS and JSON would ROCK.