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

Refactor Statement #9

@davepagurek

Description

@davepagurek

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions