Skip to content
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

cutting back scope #217

Open
nektro opened this issue Apr 16, 2024 · 3 comments
Open

cutting back scope #217

nektro opened this issue Apr 16, 2024 · 3 comments

Comments

@nektro
Copy link

nektro commented Apr 16, 2024

I think a first iteration of this proposal should limit itself to only the values from typeof, arrays, and classes in function parameter / variable / class field definitions. maybe the ?: and !. syntax too. this would provide an a common base that's easy for engines and tools to adopt while still being enough to bring immediate benefit to developers.

the readme goes into great depth about prior art but I dont think we should worry about tying ourselves strictly to being source-compatible with TypeScript due to the reasons y'all already have listed wrt standardization and not breaking the web. even though they and others have done a great job paving the road.

I also agree with engines ignoring the types at runtime while making the types available to tooling being invaluable.
and that putting the types in-source is much better than in-comments.

type declarations etc massively increase the scope and potential ambiguity in the syntax. I think it would be very beneficial to developers and the prospects of getting this landed if we started much smaller and added other features in future proposals.

great work getting this to stage 1 and I'd love to help out materially where I can to help this along :)

@nektro
Copy link
Author

nektro commented Apr 17, 2024

TypePrimitive:
  undefined
  object
  boolean
  number
  bigint
  string
  symbol
Type
  TypePrimitive
  TypePrimitive [ ]
TypeAnnotation:
  ?(opt) : Type
LexicalDeclaration:
  LetOrConst Identifier TypeAnnotation(opt) Initializer(opt)

@nektro
Copy link
Author

nektro commented Apr 17, 2024

FieldDefinition:
  ClassElementName TypeAnnotation(opt) Initializer(opt)

@nektro
Copy link
Author

nektro commented Apr 17, 2024

production OptionalAssertion would be quite similar to OptionalChain but with ?. swapped for !.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant