-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design Meeting Notes, 12/8/2021 #47073
Comments
If I only work on the parser & AST part and do not touch the type checking part, is that OK? |
I think so! If we end up using those parser changes, we'll be sure to credit your work there. |
IMO a similar is already the case since |
Not sure what is meant by this. If it means the "eszett", that has an uppercase form since 2017, although used very rarely. Uppercase: ẞ |
"ß".toUpperCase().toLowerCase() |
@DanielRosenwasser Not sure if this is the best place to ask this, but is there any appetite within the team for adding more of these intrinsic types? I have a couple ideas for some new ones, but I'm unsure whether I should propose them, as the intended scope of intrinsic types isn't totally clear to me. 😅 |
Every feature starts at -100 points, but if you can prove out the use-cases or demonstrate genuine demand, we will consider it. |
I understand a lot of disappointment can come with the issue getting turned down - but I would hope nobody tries to make you feel bad for suggesting something that falls within our design goals. If you feel like there are worthwhile things to discuss, I would encourage you to file a suggestion! |
I'm sorry, @RyanCavanaugh noticed that my comment (#47073 (comment)) should probably be updated given how old the linked post is. |
Note that One open issue with that proposal is if registered-symbols can be used in weak collections (though they won’t be collected) or if they should throw. If registered symbols throw I’m not sure if TypeScript would want to statically track this or not - similar to how empty arrays are not tracked for detecting |
If registered symbols throw I’m not sure if TypeScript would want to statically track this or not
|
I think TS could statically track registered symbols (just like unique symbol subtype), registered symbols already behave differently, their identity are based on strings so |
Casing Operators on
string
#47050
`A${string}`
.Uppercase<string>
too.string
withUppercase<string>
in the above example).Uppercase<Uppercase<T>>
simplifies to justUppercase<T>
.Uppercase<Lowercase<T>>
does not?Records and Tuples
tc39/proposal-record-tuple#9
https://gist.github.com/rbuckton/bac946eda028cd898e7b09498e6f12e8
Getting feedback from type systems on Records/Tuples.
Can't use
ReadonlyArray
to represent tuples.Records and Tuples can only contain primitive values (e.g.
string
,number
,symbol
,boolean
, etc.).Primitive
tuple
and primitiverecord
types as constraints likeobject
.Idea would be
Record
andTuple
prototypes for apparent types.Possibly provide
ReadonlyRecord
andReadonlyTuple
types.Record
type.Can also create record/tuple syntax.
Also a
box
type. Box is still a name that's being bikeshed-ed. Could imaginebox<T>
- first primitive that's generic. Could also make abox
type operator.Could we use a type alias for
Box
?Box
has a prototype, has primitive semantics.Copying the syntax for creating primitives from array tuples and object literals.
Other projects might already use
tuple
andrecord
, but maybe not a blocker.A key type of records/tuples is that they're deeply immutable; but property access syntax is the same.
readonly
ness affect assignability today.More concerns with just that - also the fact that a lot of places don't expect object-like things that are not objects.
Trying to decide if this provides enough value for the complexity.
How do you explain to users which "types of objects" they should be using?
Fair amount of overlap with "blittable" types - feels odd that these types with value semantics are not leveraged that way at all.
What's the biggest use-case? Composite keys?
Seeing syntax for
#
in front of objects - why not tagged objects?We'd also need some way to refer to "array-based tuple or immutable tuple".
Big concern over cognitive overhead - which do you use, why can't I define my own custom records, etc.
A lot of this is nice - makes sense. Some on the team feels like
box
is actually good.Then complexity with the type system itself is also very high. How do you avoid bifurcating the world?
Also, freshness rules - do properties get the
as const
semantics? If so, you can't reassign.let
means widen the recursive properties,const
means don't.let
/const
always signaled just top-level mutability. Now they impact the properties of the value.Also have a community PR from @Jack-Works (feat: support parser of record and tuple #45546).
The text was updated successfully, but these errors were encountered: