Skip to content

Conversation

@weswigham
Copy link
Member

Fixes #34994

I asked @sandersn and he was more comfortable issuing an error (at least for now) than attempting a fix that automatically wrote augmentation declarations.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Looks good, although it's a little weird that tracker and reportNonlocalAugmentation might be optional.

const localName = getInternalSymbolName(s, name);
const aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
if (containingFile && (aliasDecl ? containingFile !== getSourceFileOfNode(aliasDecl) : !some(s.declarations, d => getSourceFileOfNode(d) === containingFile))) {
context.tracker?.reportNonlocalAugmentation?.(containingFile, symbol, s);
Copy link
Member

Choose a reason for hiding this comment

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

that is an impressive number of ?. there

@andrewbranch
Copy link
Member

Is this PR relevant to #37896?

@weswigham
Copy link
Member Author

Is this PR relevant to #37896?

Don't think so - this is mostly just possible because we allow module.exports member assignment augmentations in JS, even when it's, as a whole, assigned to something else (and that something else may come from a different file).

@weswigham weswigham merged commit 815dc90 into microsoft:master Apr 24, 2020
@weswigham weswigham deleted the js-declarations-crossfile-merge branch April 24, 2020 02:01
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strange declarations created within typescript-in-jsdoc

5 participants