-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Find all refs/rename for mapped type symbols #12450
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
Comments
Hello. namespace Core {
export class Class1 { static order: "1" }
export class Class2 { static order: "2" }
}
type CoreTypes = keyof typeof Core;
type CoreObject = {[P in CoreTypes]: typeof Core[P]["order"]};
const core: CoreObject = {
Class1: "1",
Class2: "2"
} I don't even talk about import * as Core from "./file-with-exported-classes"
Would it be considered as a bug/improvement request? |
Hi @pavel-agarkov, your example works if you remove the interface X { x: number };
type Key = keyof X;
const a: { [P in Key]: string } = { x: "" }; // Can't find reference for `x`
const b: { [P in keyof X]: string } = { x: "" }; // Successfully find reference for `x` I'm not sure if this is a bug or a limitation of the way we do mapped types. CC @sandersn |
Thank you, @Andy-MS |
For some reason this doesn't work when the {
type T = { a: number, b: string };
type O = Record<keyof T, {}>;
var t: T = { a: 1, b: "s" };
var o: O = { a: 3 };
} I filed a separate issue #20272 |
renaming
a
should rename both instances ofa
T.a
andO.a
.The text was updated successfully, but these errors were encountered: