Skip to content

Suggestion: Typescript plugins #6843

Closed
Closed
@nojvek

Description

@nojvek

It seems in most typescript projects, the build setup will have tslint, tsc, and some form of minifier. This is also closely related to #8. The build setup also has someway of deciding whether to invoke the build pipe depending on what files have changed.

I believe typescript should have plugins just like babel. Basically the compiler has hook points at various before/after stages, plugins can modify scanner behaviour, parser behaviour, emitter behaviour.

This means tslint can hook in and do its checks at parser/scanner stage. There could be a plugin to support a much stronger inference, kind of like flow at the checker stage. The minifier can hook in the emitter stage.

I could write a plugin to support extra syntatic sugar. e.g is isn't, and, or, not. a plugin to support Coffeescript like omission of parenthesis and curly braces.

There could be a plugin to inline function calls, or a plugin to output computationaly intensive code as asm, or wasm.

There could be a plugin to cache the AST's so when the same file is encountered with the same hash, it can load the AST from cache speeding up the compiler.

This would mean typescript does what it needs to do the best, the community can build plugins rather than having to fork the whole typescript project to support a simple feature.

tsconfig.json would have a plugins array and just like npm init, tsc can auto download the plugins if it doesn't have them.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already createdSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions