Skip to content

Fix getChildCount/At methods in EndOfFileTokens #44991

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
merged 2 commits into from
Jul 30, 2021
Merged

Conversation

tjjfvi
Copy link
Contributor

@tjjfvi tjjfvi commented Jul 12, 2021

Before, they were hardcoded to return 0 and undefined!, respectively, but that is inaccurate for EndOfFileTokens with attached jsdoc.

Fixes #44990

Before, they were hardcoded to return `0` and `undefined!`, respectively, but that is inaccurate for `EndOfFileToken`s with attached jsdoc.
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Jul 12, 2021
}

public getChildAt(): Node {
return undefined!; // TODO: GH#18217
public getChildAt(index: number): Node {
Copy link

Choose a reason for hiding this comment

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

Should return Node | undefined?
TypeScript's codebase chould use the stricter tsconfig flags...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Theoretically, yes, but that's somewhat tangential to this PR

@DanielRosenwasser
Copy link
Member

Is there a way to get a quick test added?

@tjjfvi
Copy link
Contributor Author

tjjfvi commented Jul 14, 2021

I added a test to src/testRunner/unittests/publicApi.ts, as that seemed to be the most applicable place. All of the tests are passing, but afaict the "77248 passing" number did not go up, so I'm not sure if there's something else I need to do to add the test.

@DanielRosenwasser
Copy link
Member

but afaict the "77248 passing" number did not go up

You can try making the test fail locally as a sanity check which I'd appreciate - maybe each unittest only gets counted as its own test?

@tjjfvi
Copy link
Contributor Author

tjjfvi commented Jul 15, 2021

Good point -- the test failed successfully.

@sandersn
Copy link
Member

You can try making the test fail locally as a sanity check which I'd appreciate - maybe each unittest only gets counted as its own test?

I'm pretty sure unit tests are not part of the 77248 total. They may also run on each process for a parallel test run.

@sandersn sandersn merged commit 9d957c6 into microsoft:main Jul 30, 2021
@tjjfvi tjjfvi deleted the patch-2 branch November 23, 2021 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

getChildCount returns 0 on EndOfFileToken with JSDoc
5 participants