Skip to content

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

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

Merged
merged 8 commits into from
Sep 16, 2016

Conversation

yuit
Copy link
Contributor

@yuit yuit commented Sep 16, 2016

No description provided.

* 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
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?

if (aliasesToMakeVisible) {
if (!contains(aliasesToMakeVisible, anyImportSyntax)) {
aliasesToMakeVisible.push(anyImportSyntax);
if (shouldComputeAliasToMarkVisible) {
Copy link
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
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.

@@ -1830,7 +1838,7 @@ namespace ts {
return isAmbientModule(declaration) || (declaration.kind === SyntaxKind.SourceFile && isExternalOrCommonJsModule(<SourceFile>declaration));
}

function hasVisibleDeclarations(symbol: Symbol): SymbolVisibilityResult {
function hasVisibleDeclarations(symbol: Symbol, shouldComputeAliasToMarkVisible: boolean): SymbolVisibilityResult {
Copy link
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
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
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