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

Add TypeScript plugin #245

Closed
xiaoxiangmoe opened this issue May 24, 2020 · 4 comments
Closed

Add TypeScript plugin #245

xiaoxiangmoe opened this issue May 24, 2020 · 4 comments

Comments

@xiaoxiangmoe
Copy link
Contributor

xiaoxiangmoe commented May 24, 2020

Is your feature request related to a problem? Please describe.

We may need use new/experiment TypeScript version such as microsoft/TypeScript#33038 (comment) . Also we may need to use decorator. So we should support use tsc as compiler.

Describe the solution you'd like

Add a plugin to use tsc rather than esbuild

Describe alternatives you've considered

Additional context

@Akiyamka
Copy link

Using tsc in Vite doesn't make sense, the whole point is to throw it away.

Vite only performs transpilation on .ts files and does NOT perform type checking. It assumes type checking is taken care of by your IDE and build process (you can run tsc --noEmit in the build script).

Vite uses esbuild to transpile TypeScript into JavaScript which is about 20~30x faster than vanilla tsc, and HMR updates can reflect in the browser in under 50ms.

Note that because esbuild only performs transpilation without type information, it doesn't support certain features like const enum and implicit type-only imports. You must set "isolatedModules": true in your tsconfig.json under compilerOptions so that TS will warn you against the features that do not work with isolated transpilation.

@xiaoxiangmoe
Copy link
Contributor Author

xiaoxiangmoe commented May 24, 2020

I want to use tsc to transpile TypeScript without type checking. This proposal using tsc only for new syntax, for example: nominal unique type brands .

I'm using tsc with noEmit to type check .

@yyx990803
Copy link
Member

There is plan for esbuild to support decorators: evanw/esbuild#104 (comment)

If you really need it you can write your own plugin.

@utenma
Copy link

utenma commented Jul 13, 2021

would be nice to use tsc, this enables to specify options like JSX factory injection in the tsconfig.json

for example using emotion.js in react the tsconfig.json requires:

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "@emotion/react",
  }
}

@github-actions github-actions bot locked and limited conversation to collaborators Jul 28, 2021
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

4 participants