-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Allow unexported local type aliases to be displayed in quickinfo. (#13095) #23638
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @Filename: fileA.ts | ||
//// type LocalAlias<T> = {a: T} | ||
//// const var/*0*/1: LocalAlias<string> | ||
//// export type ExpAlias<T> = {b: T} | ||
//// const var/*1*/2: ExpAlias<string> | ||
//// export declare function doSomething<T>(arg: T): ExpAlias<T> | ||
|
||
// @Filename: fileB.ts | ||
//// import { doSomething, ExpAlias } from "./fileA"; | ||
//// type FileBAlias<T> = {c: T} | ||
//// declare const fba: FileBAlias<string> | ||
//// const res/*2*/ult = doSomething(fba); | ||
|
||
// @Filename: GH18754.ts | ||
//// import "nothing" | ||
//// type A/*3*/A = { tag: 'a', p/*4*/a: AL/*5*/L} | ||
//// type BB = { tag: 'b', pb: ALL} | ||
//// type ALL = AA | BB | ||
//// declare var b/*6*/b: B/*7*/B | ||
//// declare let a/*8*/ll: A/*9*/LL | ||
|
||
verify.quickInfos({ | ||
0: "const var1: LocalAlias<string>", | ||
1: "const var2: ExpAlias<string>", | ||
2: "const result: ExpAlias<FileBAlias<string>>", | ||
3: 'type AA = {\n tag: "a";\n pa: ALL;\n}', | ||
4: "(property) pa: ALL", | ||
5: "type ALL = AA | BB", | ||
6: "var bb: BB", | ||
7: 'type BB = {\n tag: "b";\n pb: ALL;\n}', | ||
8: "let all: ALL", | ||
9: "type ALL = AA | BB", | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used by the declaration emitter, in addition to quick info and signature help, and I don't see any checks actually accounting for the enclosing declaration context, which worries me. Additionally, given that we have a
UseAliasDefinedOutsideCurrentScope
flag, I'm led to believe that one would believe that this should be the default behavior! However that may have to wait for #23351 though, which may, incidentally, subsume this. Will have to test.