Skip to content

Serialize inferred type alias when type alias symbol is not accessible#10953

Merged
yuit merged 8 commits into
masterfrom
emitTypeAliasInDeclarationFile
Sep 16, 2016
Merged

Serialize inferred type alias when type alias symbol is not accessible#10953
yuit merged 8 commits into
masterfrom
emitTypeAliasInDeclarationFile

Conversation

@yuit
Copy link
Copy Markdown
Contributor

@yuit yuit commented Sep 16, 2016

No description provided.

Comment thread src/compiler/checker.ts Outdated
* Check if the given symbol in given enclosing declaration is accessible and mark all associated alias to be visible if requested
*
* @param symbol a Symbol to check if accessible
* @param enclosingDeclaration a Node containing the symbol
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

a Node containing reference to the symbol?

Comment thread src/compiler/checker.ts Outdated
if (aliasesToMakeVisible) {
if (!contains(aliasesToMakeVisible, anyImportSyntax)) {
aliasesToMakeVisible.push(anyImportSyntax);
if (shouldComputeAliasToMarkVisible) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems not completely correct. Because You wouldn't be making the alias visible yet returning that the declaration is visible. At the consumer side say result of all this is that the symbol is visible. (not the false case that you have marked) then you definitely going to get error in the .d.ts file because you should have made the alias visible for the correct emit of the declaration file but it isn't going to be emitted.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I get it why it works because here you just check if this is visible but the tracking of the symbol does happen again when actually writing the symbol. Probably we need a comment here explaining that.

Comment thread src/compiler/checker.ts Outdated
}

function hasVisibleDeclarations(symbol: Symbol): SymbolVisibilityResult {
function hasVisibleDeclarations(symbol: Symbol, shouldComputeAliasToMarkVisible: boolean): SymbolVisibilityResult {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

MarkVisible or MakeVisible?

Copy link
Copy Markdown
Contributor Author

@yuit yuit Sep 16, 2016

Choose a reason for hiding this comment

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

make :)

@sheetalkamat
Copy link
Copy Markdown
Member

👍

@yuit yuit merged commit 599d2b0 into master Sep 16, 2016
@yuit yuit deleted the emitTypeAliasInDeclarationFile branch September 16, 2016 23:30
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants