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

include types export for ts4.7 nodenext resolution #1193

Merged
merged 1 commit into from
May 1, 2022
Merged

include types export for ts4.7 nodenext resolution #1193

merged 1 commit into from
May 1, 2022

Conversation

lizthegrey
Copy link
Contributor

@lizthegrey lizthegrey commented May 1, 2022

See microsoft/TypeScript#47792 (comment)

otherwise, building with nodenext resolution results in:

.yarn/__virtual__/terser-webpack-plugin-virtual-7ea69a4a8a/2/.yarn/berry/cache/terser-webpack-plugin-npm-5.3.1-0c0596f996-9.zip/node_modules/terser-webpack-plugin/types/index.d.ts:116:39 - error TS7016: Could not find a declaration file for module 'terser'. '/home/lizf/.yarn/berry/cache/terser-npm-5.7.2-c24448e930-9.zip/node_modules/terser/dist/bundle.min.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/terser` if it exists or add a new declaration (.d.ts) file containing `declare module 'terser';`

116 declare class TerserPlugin<T = import("terser").MinifyOptions> {
                                          ~~~~~~~~

.yarn/__virtual__/terser-webpack-plugin-virtual-7ea69a4a8a/2/.yarn/berry/cache/terser-webpack-plugin-npm-5.3.1-0c0596f996-9.zip/node_modules/terser-webpack-plugin/types/index.d.ts:293:17 - error TS7016: Could not find a declaration file for module 'terser'. '/home/lizf/.yarn/berry/cache/terser-npm-5.7.2-c24448e930-9.zip/node_modules/terser/dist/bundle.min.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/terser` if it exists or add a new declaration (.d.ts) file containing `declare module 'terser';`

293   ecma?: import("terser").ECMA | undefined;
                    ~~~~~~~~

.yarn/__virtual__/terser-webpack-plugin-virtual-7ea69a4a8a/2/.yarn/berry/cache/terser-webpack-plugin-npm-5.3.1-0c0596f996-9.zip/node_modules/terser-webpack-plugin/types/utils.d.ts:3:42 - error TS7016: Could not find a declaration file for module 'terser'. '/home/lizf/.yarn/berry/cache/terser-npm-5.7.2-c24448e930-9.zip/node_modules/terser/dist/bundle.min.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/terser` if it exists or add a new declaration (.d.ts) file containing `declare module 'terser';`

3 export type TerserFormatOptions = import("terser").FormatOptions;
                                           ~~~~~~~~

.yarn/__virtual__/terser-webpack-plugin-virtual-7ea69a4a8a/2/.yarn/berry/cache/terser-webpack-plugin-npm-5.3.1-0c0596f996-9.zip/node_modules/terser-webpack-plugin/types/utils.d.ts:4:36 - error TS7016: Could not find a declaration file for module 'terser'. '/home/lizf/.yarn/berry/cache/terser-npm-5.7.2-c24448e930-9.zip/node_modules/terser/dist/bundle.min.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/terser` if it exists or add a new declaration (.d.ts) file containing `declare module 'terser';`

4 export type TerserOptions = import("terser").MinifyOptions;
                                     ~~~~~~~~

.yarn/__virtual__/terser-webpack-plugin-virtual-7ea69a4a8a/2/.yarn/berry/cache/terser-webpack-plugin-npm-5.3.1-0c0596f996-9.zip/node_modules/terser-webpack-plugin/types/utils.d.ts:5:33 - error TS7016: Could not find a declaration file for module 'terser'. '/home/lizf/.yarn/berry/cache/terser-npm-5.7.2-c24448e930-9.zip/node_modules/terser/dist/bundle.min.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/terser` if it exists or add a new declaration (.d.ts) file containing `declare module 'terser';`

5 export type TerserECMA = import("terser").ECMA;
                                  ~~~~~~~~

@fabiosantoscode
Copy link
Collaborator

Hey there, thanks for this contribution!

I wasn't aware that it was necessary to place a path to the typedefs there, but it makes sense.

@fabiosantoscode fabiosantoscode merged commit 2d59a11 into terser:master May 1, 2022
@lizthegrey lizthegrey deleted the patch-1 branch May 1, 2022 21:16
@lizthegrey
Copy link
Contributor Author

lizthegrey commented May 1, 2022

@fabiosantoscode looks like I got it wrong.

https://www.typescriptlang.org/docs/handbook/esm-node.html#:~:text=%22.%22%3A%20%7B-,%2F%2F%20Entry-point%20for%20TypeScript,types%2Findex.d.ts%22%2C,-%2F%2F%20Entry-point%20for says that types must come first in the exports.

it also looks like that should have been relative (./tools/ rather than tools/)

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

Successfully merging this pull request may close these issues.

None yet

2 participants