Skip to content

improve SourceLocation typing#15776

Merged
nicolo-ribaudo merged 2 commits intobabel:mainfrom
JLHwung:improve-source-location-typing
Jul 13, 2023
Merged

improve SourceLocation typing#15776
nicolo-ribaudo merged 2 commits intobabel:mainfrom
JLHwung:improve-source-location-typing

Conversation

@JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jul 12, 2023

Q                       A
Fixed Issues? Fixes #15775
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

In this PR we align the SourceLocation typing with the one in @babel/parser:

export class Position {
line: number;
column: number;
index: number;
constructor(line: number, col: number, index: number) {
this.line = line;
this.column = col;
this.index = index;
}
}
export class SourceLocation {
start: Position;
end: Position;
filename: string;
identifierName: string | undefined | null;
constructor(start: Position, end?: Position) {
this.start = start;
// (may start as null, but initialized later)
this.end = end;
}
}

@JLHwung JLHwung added PR: Polish 💅 A type of pull request used for our changelog categories pkg: types labels Jul 12, 2023
@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/54849/

@nicolo-ribaudo nicolo-ribaudo merged commit 52244bf into babel:main Jul 13, 2023
@nicolo-ribaudo nicolo-ribaudo deleted the improve-source-location-typing branch July 13, 2023 08:36
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: types PR: Polish 💅 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Incorrect SourceLocation typings

4 participants