Skip to content

Commit

Permalink
Fix ESM type import in Webpack loader CJS file
Browse files Browse the repository at this point in the history
TypeScript 5.3 introduced support for import attributes and
`resolution-mode`. This can be used to import types from ESM files into
CJS files without a `@ts-ignore` comment.
  • Loading branch information
remcohaszing committed Mar 5, 2024
1 parent 8f754f7 commit a74d951
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/loader/index.cjs
@@ -1,10 +1,8 @@
/**
* @typedef {import('webpack').LoaderContext<unknown>} LoaderContext
* @typedef {import('./lib/index.js', {with: {'resolution-mode': 'import'}}).Options} Options
*/

// @ts-expect-error: TS complains about CJS importing ESM but it works.
/** @typedef {import('./lib/index.js').Options} Options */

'use strict'

// Note: we can’t export immediately, as TS generates broken types.
Expand Down

0 comments on commit a74d951

Please sign in to comment.