Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Quick fix to correct qualified names to indexed access types#17462

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@DanielRosenwasser
Copy link
Member

@DanielRosenwasserDanielRosenwasser commentedJul 27, 2017
edited
Loading

Fixes#17461

qnwithiat

@DanielRosenwasserDanielRosenwasser changed the titleCode fix for error for property of type as typeQuick fix to correct qualified names to indexed access typesJul 27, 2017
Copy link
Contributor

@aozgaaaozgaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Not sure you want to make changes to get the fix working in the case mentioned below, but please add a test.

consttoken=getTokenAtPosition(sourceFile,context.span.start,/*includeJsDocComment*/false);
constqualifiedName=getAncestor(token,SyntaxKind.QualifiedName)asQualifiedName;
Debug.assert(!!qualifiedName,"Expected position to be owned by a qualified name.");
if(!isIdentifier(qualifiedName.left)){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This example doesn't seem to trigger the right error, though we can apply the fix manually to fix the issue:

module M {    export interface I {         foo: string;    }}let a: M.I.foo;

Please add a test.

@@ -1,3 +1,4 @@
/// <reference path="correctQualifiedNameToIndexedAccessType.ts" />
/// <reference path="fixClassIncorrectlyImplementsInterface.ts" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks like there is an analogous entry to this insrc/harness/tsconfig.json. Not sure why it's there, or if we might want to remove it. Or alternatively, add a reference tocorrectQualifiedNameToIndexedAccessType.ts.

@weswigham do you know if building for tests will correctly trigger a rebuild when we make changes tocorrectQualifiedNameToIndexedAccessType.ts?

@DanielRosenwasser
Copy link
MemberAuthor

@aozgaa no, I didn't generalize the check, but I can at a later point. I did add a negative fourslash test, and augmented the tests added in#17459.

…e already referenced in 'src/harness/codefixes/fixes.ts'.
@DanielRosenwasserDanielRosenwasser merged commit6565025 intomasterJul 27, 2017
@DanielRosenwasserDanielRosenwasser deleted the codeFixForErrorForPropertyOfTypeAsType branchJuly 27, 2017 22:32
@microsoftmicrosoft locked and limited conversation to collaboratorsJun 14, 2018
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@weswighamweswighamweswigham approved these changes

+1 more reviewer

@aozgaaaozgaaaozgaa approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@DanielRosenwasser@weswigham@aozgaa@msftclas

[8]ページ先頭

©2009-2025 Movatter.jp