Skip to content
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

Import declaration of type does works if an imported variable name does not match the original type name in the namespaces approach. #1400

Closed
dimarudnev opened this issue Nov 23, 2020 · 2 comments
Labels
bug Functionality does not match expectation

Comments

@dimarudnev
Copy link

Search terms

namespaces, import, renaming, types

Steps to reproduce the bug

  1. Create the d.ts file with the following content in the empty folder
declare module NamespaceA {
	export interface InterfaceA { }
	//export type renamedInterfaceA =  InterfaceA; // WA to typedoc v0.15
}
declare module NamespaceB {
	export interface InterfaceA { }
}
declare module NamespaceC {
	import renamedInterfaceA = NamespaceA.InterfaceA;
	import InterfaceA = NamespaceB.InterfaceA;
	    
	export class TestClass {
		testMethod1(options: renamedInterfaceA): any;
		testMethod2(options: InterfaceA): any;
	}
}

  1. Run
typedoc --includeDeclarations --excludePrivate --target ES5 .

See the generated types of the parameter of testMethod1 and testMethod2
The JSON output equvalent: typedoc019.ts405.zip

Expected Behavior

The "option" parameter of testMethod1 is referred to the NamespaceA.InterfaceA.
The "option" parameter of testMethod2 is referred to the NamespaceB.InterfaceA.

Actual Behavior

The "option" parameter of testMethod1 has the incorrect type and referred to the root of NamespaceC. In json renamedInterfaceA is variable inside NamespaceC without type.
The "option" parameter of testMethod2 has the correct type and referred to the NamespaceB.InterfaceA.

Environment

  • Typedoc version: 0.19.2
  • TypeScript version: 4.0.5
  • Node.js version: 12.18.3
  • OS: windows 10

Possible related tickets:

#1353
#435

Does this issue is going to be fixed in v0.20 ?

@dimarudnev dimarudnev added the bug Functionality does not match expectation label Nov 23, 2020
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Nov 25, 2020

Yep, this is fixed in v0.20. I had to make one change because I apparently broke global files, but in v0.20.0-beta.12 this produces the expected result.

@Gerrit0 Gerrit0 added this to To do in Version 0.20 via automation Nov 25, 2020
@Gerrit0 Gerrit0 moved this from To do to Done in Version 0.20 Nov 25, 2020
@dimarudnev
Copy link
Author

I have also tested my issue solution with typedoc@0.20.0-beta.14 and it works as expected. Thank you, very much for your work. Typedoc is a very helpful tool!

@Gerrit0 Gerrit0 closed this as completed Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
No open projects
Development

No branches or pull requests

2 participants