-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Transfer all declared symbols onto the type from the interface that extends another #55252
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
jakebailey
merged 7 commits into
microsoft:main
from
Andarist:fix/quick-info-index-signature-on-interface-with-base
Aug 28, 2023
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d436316
Transfer all declared symbols onto the type from the interface that e…
Andarist aa36cbc
Make `createSymbolTable` accept `Iterable`
Andarist 1caae73
Merge remote-tracking branch 'origin/main' into fix/quick-info-index-…
Andarist 8f6da4b
dont transfer type parameter symbols
Andarist 38bd33f
Merge remote-tracking branch 'origin/main' into fix/quick-info-index-…
Andarist 31d14c0
revert `createSymbolTable` change
Andarist 26cd2f4
Actually set members to the created symbol table
Andarist 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
75 changes: 75 additions & 0 deletions
75
...nes/reference/classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.symbols
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,75 @@ | ||
//// [tests/cases/compiler/classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts] //// | ||
|
||
=== classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts === | ||
interface IObserver { | ||
>IObserver : Symbol(IObserver, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 0, 0)) | ||
|
||
handleChange<T, TChange>(observable: IObservable<T, TChange>, change: TChange): void; | ||
>handleChange : Symbol(IObserver.handleChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 0, 21)) | ||
>T : Symbol(T, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 1, 14)) | ||
>TChange : Symbol(TChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 1, 16)) | ||
>observable : Symbol(observable, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 1, 26)) | ||
>IObservable : Symbol(IObservable, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 2, 1)) | ||
>T : Symbol(T, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 1, 14)) | ||
>TChange : Symbol(TChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 1, 16)) | ||
>change : Symbol(change, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 1, 62)) | ||
>TChange : Symbol(TChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 1, 16)) | ||
} | ||
|
||
interface IObservable<T, TChange = unknown> { | ||
>IObservable : Symbol(IObservable, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 2, 1)) | ||
>T : Symbol(T, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 4, 22)) | ||
>TChange : Symbol(TChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 4, 24), Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 5, 10)) | ||
|
||
get(): T; | ||
>get : Symbol(IObservable.get, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 4, 45)) | ||
>T : Symbol(T, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 4, 22)) | ||
|
||
readonly TChange: TChange; | ||
>TChange : Symbol(TChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 4, 24), Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 5, 10)) | ||
>TChange : Symbol(TChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 4, 24), Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 5, 10)) | ||
} | ||
|
||
export interface IReader { | ||
>IReader : Symbol(IReader, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 7, 1)) | ||
|
||
readObservable<T>(observable: IObservable<T, any>): T; | ||
>readObservable : Symbol(IReader.readObservable, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 9, 26)) | ||
>T : Symbol(T, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 10, 16)) | ||
>observable : Symbol(observable, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 10, 19)) | ||
>IObservable : Symbol(IObservable, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 2, 1)) | ||
>T : Symbol(T, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 10, 16)) | ||
>T : Symbol(T, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 10, 16)) | ||
} | ||
|
||
export abstract class ConvenientObservable<T, TChange> implements IObservable<T, TChange> { | ||
>ConvenientObservable : Symbol(ConvenientObservable, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 11, 1)) | ||
>T : Symbol(T, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 13, 43)) | ||
>TChange : Symbol(TChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 13, 45), Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 13, 91)) | ||
>IObservable : Symbol(IObservable, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 2, 1)) | ||
>T : Symbol(T, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 13, 43)) | ||
>TChange : Symbol(TChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 13, 45), Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 13, 91)) | ||
|
||
get TChange(): TChange { return null!; } | ||
>TChange : Symbol(TChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 13, 45), Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 13, 91)) | ||
>TChange : Symbol(TChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 13, 45), Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 13, 91)) | ||
|
||
public abstract get(): T; | ||
>get : Symbol(ConvenientObservable.get, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 14, 41)) | ||
>T : Symbol(T, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 13, 43)) | ||
} | ||
|
||
export abstract class BaseObservable<T, TChange = void> extends ConvenientObservable<T, TChange> { | ||
>BaseObservable : Symbol(BaseObservable, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 16, 1)) | ||
>T : Symbol(T, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 18, 37)) | ||
>TChange : Symbol(TChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 18, 39)) | ||
>ConvenientObservable : Symbol(ConvenientObservable, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 11, 1)) | ||
>T : Symbol(T, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 18, 37)) | ||
>TChange : Symbol(TChange, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 18, 39)) | ||
|
||
protected readonly observers = new Set<IObserver>(); | ||
>observers : Symbol(BaseObservable.observers, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 18, 98)) | ||
>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
>IObserver : Symbol(IObserver, Decl(classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts, 0, 0)) | ||
} | ||
|
45 changes: 45 additions & 0 deletions
45
...lines/reference/classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.types
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,45 @@ | ||
//// [tests/cases/compiler/classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts] //// | ||
|
||
=== classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts === | ||
interface IObserver { | ||
handleChange<T, TChange>(observable: IObservable<T, TChange>, change: TChange): void; | ||
>handleChange : <T, TChange>(observable: IObservable<T, TChange>, change: TChange) => void | ||
>observable : IObservable<T, TChange> | ||
>change : TChange | ||
} | ||
|
||
interface IObservable<T, TChange = unknown> { | ||
get(): T; | ||
>get : () => T | ||
|
||
readonly TChange: TChange; | ||
>TChange : TChange | ||
} | ||
|
||
export interface IReader { | ||
readObservable<T>(observable: IObservable<T, any>): T; | ||
>readObservable : <T>(observable: IObservable<T, any>) => T | ||
>observable : IObservable<T, any> | ||
} | ||
|
||
export abstract class ConvenientObservable<T, TChange> implements IObservable<T, TChange> { | ||
>ConvenientObservable : ConvenientObservable<T, TChange> | ||
|
||
get TChange(): TChange { return null!; } | ||
>TChange : TChange | ||
>null! : never | ||
|
||
public abstract get(): T; | ||
>get : () => T | ||
} | ||
|
||
export abstract class BaseObservable<T, TChange = void> extends ConvenientObservable<T, TChange> { | ||
>BaseObservable : BaseObservable<T, TChange> | ||
>ConvenientObservable : ConvenientObservable<T, TChange> | ||
|
||
protected readonly observers = new Set<IObserver>(); | ||
>observers : Set<IObserver> | ||
>new Set<IObserver>() : Set<IObserver> | ||
>Set : SetConstructor | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
tests/cases/compiler/classExtendingAbstractClassWithMemberCalledTheSameAsItsOwnTypeParam.ts
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,25 @@ | ||
// @strict: true | ||
// @lib: esnext | ||
// @noEmit: true | ||
|
||
interface IObserver { | ||
handleChange<T, TChange>(observable: IObservable<T, TChange>, change: TChange): void; | ||
} | ||
|
||
interface IObservable<T, TChange = unknown> { | ||
get(): T; | ||
readonly TChange: TChange; | ||
} | ||
|
||
export interface IReader { | ||
readObservable<T>(observable: IObservable<T, any>): T; | ||
} | ||
|
||
export abstract class ConvenientObservable<T, TChange> implements IObservable<T, TChange> { | ||
get TChange(): TChange { return null!; } | ||
public abstract get(): T; | ||
} | ||
|
||
export abstract class BaseObservable<T, TChange = void> extends ConvenientObservable<T, TChange> { | ||
protected readonly observers = new Set<IObserver>(); | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/cases/fourslash/quickInfoOnPropDeclaredUsingIndexSignatureOnInterfaceWithBase.ts
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,12 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// https://github.com/microsoft/TypeScript/issues/55251 | ||
|
||
//// interface P {} | ||
//// interface B extends P { | ||
//// [k: string]: number; | ||
//// } | ||
//// declare const b: B; | ||
//// b.t/*1*/est = 10; | ||
|
||
verify.quickInfoAt("1", "(index) B[string]: number"); |
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.
Uh oh!
There was an error while loading. Please reload this page.