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

Parse TypeScript syntax #690

Closed
50 of 57 tasks
strager opened this issue Apr 15, 2022 · 7 comments
Closed
50 of 57 tasks

Parse TypeScript syntax #690

strager opened this issue Apr 15, 2022 · 7 comments
Assignees
Milestone

Comments

@strager
Copy link
Collaborator

strager commented Apr 15, 2022

Parser and variable analyzer:

Integrations:

@strager strager mentioned this issue Apr 15, 2022
@strager strager pinned this issue Apr 15, 2022
@strager strager self-assigned this Apr 30, 2022
@strager
Copy link
Collaborator Author

strager commented Apr 30, 2022

@strager
Copy link
Collaborator Author

strager commented May 1, 2022

Interfaces

  • interfaces are typechecking-only and cannot be used in expressions.
  • functions, const/let/var/catch variables, and parameters are runtime-only and cannot be used in types.
  • classes are usable both in expressions and in types.
  • imported variables are usable according to the above rules. Without looking at the imported module, there is no way to know if an imported variable can be used in an expression or in a type.

Conflicts:

  • If an interface and a function/variable have the same name, there is no ambiguity.
  • If an interface has the same name as an imported class or interface, there is a compile error.
  • If an interface has the same name as an imported function/const/let/var, there is no compile error.
  • If an interface and a class have the same name, then the declarations seem to be merged (union of all members). This can lead to violations in the type system. For example:
interface I { field: number }
class I { }
let o = new I(); // not a type error
console.log(o.field.toString()); // run-time error!

@strager
Copy link
Collaborator Author

strager commented May 27, 2022

@strager strager added this to the 3.0 milestone Jul 26, 2022
@strager
Copy link
Collaborator Author

strager commented Jul 29, 2022

@strager
Copy link
Collaborator Author

strager commented Sep 29, 2022

TypeScript has too many syntax-level features. @_@

@vegerot
Copy link
Sponsor Contributor

vegerot commented Jan 26, 2023

TypeScript has too many syntax-level features. @_@

you're tellin' me!

@strager strager modified the milestone: 3.0 Dec 31, 2023
@strager
Copy link
Collaborator Author

strager commented Jan 1, 2024

Shipped in version 3.0.0.

@strager strager closed this as completed Jan 1, 2024
@strager strager unpinned this issue Jan 1, 2024
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

2 participants