Skip to content

Allow transformers to run without type-checking #41986

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

Open
5 tasks done
pauldraper opened this issue Dec 16, 2020 · 3 comments
Open
5 tasks done

Allow transformers to run without type-checking #41986

pauldraper opened this issue Dec 16, 2020 · 3 comments
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@pauldraper
Copy link

Search Terms

transformer, type check, transpileModule

Suggestion

Run transformers, but skip type checking.

Use Cases

The majority of compile times are type checking.

Some projects (e.g. Angular stylesheet integration) require transformers to run.

I would like to skip type checking, ala transpileModule, but still run the transformer.

angular/angular-cli#19587

Examples

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.
@RyanCavanaugh RyanCavanaugh added Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript labels Dec 16, 2020
@hardfist
Copy link

hardfist commented Apr 12, 2021

We also want this feature, for large monorepo project(40+ package), tsc build speed is too slow(may cost 10+ mins to compile whole project), even thou we could speed up build speed using esbuild, we still need to generate dts(which esbuild does not support), so we want generate dts without doing typecheck(which costs most of the time), we also use transpileModule on serve side to transform es6 code to es5, which typecheck slows the build speed and makes no sense on server side.

@Kingwl
Copy link
Contributor

Kingwl commented Apr 13, 2021

It's not possible yet. The transformer has some dependency on the type checker.

eg: EmitResolver.createTypeOfDeclaration

We have:

let a = 1

transform to:

declare let a: number;

Which means It's not pure syntax transform. We have to check the type to create the type annotation number.

@pauldraper
Copy link
Author

or large monorepo project(40+ package), tsc build speed is too slow

transpileModule tis the only way.

Side note: Kind of odd you can't do it via CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants