Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

Refactor Statement #9

Open
davepagurek opened this issue Oct 22, 2017 · 0 comments
Open

Refactor Statement #9

davepagurek opened this issue Oct 22, 2017 · 0 comments

Comments

@davepagurek
Copy link
Member

Statement currently just adds a semicolon. However, there are more types of statements that don't do this (e.g. if statements.) They all do not have a return value. What's the best way to encode this as a TypeScript type?

Typescript doesn't really do nominal types, only structural types, so if we make a Statement interface that is the exact same as the SyntaxNode interface, then we could pass in an arbitrary SyntaxNode anywhere we want a Statement, which isn't what we want.

If there are a fixed number of statement types, we could maybe do something like:

type Statement = If | While | DoWhile | For | Line;

(also is there a better name for Line?)

Thoughts?

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

No branches or pull requests

1 participant