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

feat: implement write-dts mode #679

Merged
merged 1 commit into from Nov 29, 2021
Merged

Conversation

adriangodong
Copy link
Contributor

@adriangodong adriangodong commented Nov 24, 2021

This PR adds a new mode called write-dts. When selected, the plugin will emit tsbuildinfo, d.ts, and d.ts.map files. This allows the plugin to work together with ts-loader (with transpileOnly set to true) or babel-loader and emit type definition files.

Fixes #663, #658

Copy link
Collaborator

@piotr-oles piotr-oles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks great, I will wait for the CI and if everything is green, we're good to merge :) Thanks for the contribution!

@adriangodong
Copy link
Contributor Author

@piotr-oles ping for merge 🙏

@piotr-oles piotr-oles merged commit 61f7cdf into TypeStrong:main Nov 29, 2021
@piotr-oles
Copy link
Collaborator

🎉 This PR is included in version 6.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@PierBJX
Copy link

PierBJX commented Dec 14, 2021

@piotr-oles @onigoetz @adriangodong

After investigation (look at e2e test), in order to make it work, you need to set the build typescript option to true.

See the working configuration:

module.exports = {
  entry: './foo.ts',
  module: {
    rules: [
      {
        test: /\.ts$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'ts-loader',
            options: {
              transpileOnly: true,
            },
          },
        ],
      },
    ],
  },
  plugins: [
    new ForkTsChecker({
      typescript: {
        build: true,
        mode: 'write-dts',
      },
    }),
  ],
};

I don't know if it was the expected behavior but with this configuration it works. Remove build: true, you will see it does not work anymore. Indeed, by default, the value is set to false.

@piotr-oles
Copy link
Collaborator

🎉 This PR is included in version 7.0.0-alpha.15 🎉

The release is available on:

Your semantic-release bot 📦🚀

@piotr-oles
Copy link
Collaborator

🎉 This PR is included in version 6.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to emit .d.ts and .d.ts.map files?
3 participants