Skip to content

Conversation

sparecycles
Copy link
Contributor

This fixes generation of typescriptServices.d.ts,
although this is not a current requirement
( #465 ).

I don't have a unit test yet. [EDIT: I added a unit test]

[EDIT] This PR fixes #466.

This fixes generation of typescriptServices.d.ts,
although this is not a current requirement
( #465 ).
@sparecycles
Copy link
Contributor Author

The purpose of using getParentOfSymbol is that the result is normalized through getMergedSymbol.

Later the symbols are identically compared and if they are not normalized to be the merged symbol the comparison will fail when it ought to succeed:
https://github.com/sparecycles/TypeScript/blob/fix/checker-declaration/src/compiler/checker.ts#L685

@sparecycles
Copy link
Contributor Author

Here's a small test case which is fixed by this PR:

( To be added as a new baseline test case ) [EDIT: Done and done]

A.ts

module A { export interface I { } }

B.ts

/// <reference path="A.ts" />

module A { ; } // This module confuses the typechecker

module B {
    export function f(): A.I {
        return null;
    }
}

Pre-PR Result

node ../built/local/tsc.js B.ts --declaration --out out.js
B.ts(6,21): Return type of exported function has or is using private name 'A.I'.

@sparecycles
Copy link
Contributor Author

Thanks @MaceWindu for pointing out that this fixes #446

@sheetalkamat
Copy link
Member

👍

sheetalkamat added a commit that referenced this pull request Aug 18, 2014
fix --declaration typechecking (complex case)
@sheetalkamat sheetalkamat merged commit 7a5512c into microsoft:master Aug 18, 2014
@sparecycles sparecycles deleted the fix/checker-declaration branch September 24, 2014 20:11
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 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.

2 participants