question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to opt-out of Babel based Typescript support and use the original Typescript compiler

See original GitHub issue

Feature request

Ability to opt-out of Babel based Typescript support and use the original Typescript compiler

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

Yes, it’s related to problems because Babel Typescript plugin isn’t fully featured and does not support all the features of Typescript and has multiple caveats (e.g. with types re-exporting or .d.ts files for styles with export =).

Describe the solution you’d like

  • Have an ability to turn off automatic .ts/tsx/d.ts files transpiling by Babel in the Nextjs config file.
  • Have an ability to plug in Typescript original compiler in the development flow (e.g. use separate plugin the will modify a webpack config). (Will the old version of next-typescript plugin work?)

Describe alternatives you’ve considered

Not sure about alternatives in this particular case. But I’m open for ideas!

Additional context

n/a for now

Has not found any other issues with such specific request so created a new one.

I’m very happy to see the progress that you folks are doing with Nextjs! Especially cool to see a huge library of examples. I’m volunteering and would be really happy help with this features somehow or to create an example and write a documentation. But does not have a huge knowledge about Nextjs internals 😦

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
timneutkenscommented, Jan 2, 2020

We’re not planning to change this at this point in time.

1reaction
zetokecommented, Sep 11, 2019

@Janpot

The first one

Does not support export = and import =, because those cannot be compiled to ES.next.

this one presented in items from officially described caveats/problems list in the documentation of the transformer https://babeljs.io/docs/en/babel-plugin-transform-typescript#caveats and will not be fixed I think. With other stuff in this list.

The second one exists in Nextjs issues https://github.com/zeit/next.js/issues/7882

It’s only a couple of examples. Of course I don’t use all the features and will probably not see other problems since I don’t use all the features of Typescript usually but I just worry that I can’t write valid Typescript without keeping in mind all the constraints of Babel’s Typescript transformer (and this is a big list!) and need to google and find workarounds for already existent projects.

And I just think if there would an ability to opt out I can use incremental builds from Typescript 3.6 without big drop offs in build performance for development purposes.

Thank you guys for the very quick answers here!

cc @timneutkens

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ability to opt-out of Babel based Typescript support and use ...
Yes, it's related to problems because Babel Typescript plugin isn't fully featured and does not support all the features of Typescript and has ......
Read more >
Documentation - Using Babel with TypeScript
This technique is a hybrid approach, using Babel's preset-typescript to generate your JS files, and then using TypeScript to do type checking and...
Read more >
Babel vs. TypeScript: Choosing the right compiler for your ...
Should you use Babel? TypeScript? Both? See how the two JavaScript compilers compare through performance, custom transformations, and more.
Read more >
Compiling TypeScript into JavaScript | IntelliJ IDEA ... - JetBrains
IntelliJ IDEA comes with a built-in TypeScript compiler. ... window shows up only after you first compile your TypeScript code manually.
Read more >
TypeScript and Babel 7 - Microsoft Developer Blogs
Using the TypeScript compiler is still the preferred way to build TypeScript. While Babel can take over compiling/transpiling – doing things ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found