Skip to content

feat: warn when using the separate declaration option with a script output - #513

Merged
dsherret merged 2 commits into
denoland:mainfrom
dsherret:warn_separate_declaration
Jul 27, 2026
Merged

feat: warn when using the separate declaration option with a script output#513
dsherret merged 2 commits into
denoland:mainfrom
dsherret:warn_separate_declaration

Conversation

@dsherret

Copy link
Copy Markdown
Collaborator

Closes #327

Per your comment on the issue, this warns when declaration: "separate" is used alongside a CommonJS/UMD output:

[dnt] The 'separate' declaration build option outputs the same type declarations for the ESM and CommonJS/UMD output, but they describe the ESM output. Use the default 'inline' option instead, which outputs the declarations beside the code they describe.

There's no warning when scriptModule is false, since there's only the one output for the declarations to describe.

The option's jsdoc also gets a @deprecated note pointing at "inline".

dsherret added 2 commits July 26, 2026 23:50
…utput

The declarations describe the ESM output, so sharing them with the
CommonJS/UMD output isn't correct for a CommonJS consumer.

Closes denoland#327
- don't use a jsdoc tag, which applied the deprecation to the whole option
- only warn when there's both an esm and a script output
@dsherret
dsherret merged commit f946d30 into denoland:main Jul 27, 2026
5 checks passed
@dsherret
dsherret deleted the warn_separate_declaration branch July 27, 2026 19:36
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.

Using 'seperate' declaration with CommonJS creates invalid types

1 participant