Skip to content
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

Add lastGeneratedColumn to typing for MappingItem #374

Merged
merged 1 commit into from
Oct 29, 2019

Conversation

samccone
Copy link
Contributor

This is generated when someone calls computeColumnSpans so we mark the property as optional as well.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 541

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.385%

Totals Coverage Status
Change from base Build 539: 0.0%
Covered Lines: 824
Relevant Lines: 911

💛 - Coveralls

3 similar comments
@coveralls
Copy link

Pull Request Test Coverage Report for Build 541

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.385%

Totals Coverage Status
Change from base Build 539: 0.0%
Covered Lines: 824
Relevant Lines: 911

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build 541

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.385%

Totals Coverage Status
Change from base Build 539: 0.0%
Covered Lines: 824
Relevant Lines: 911

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build 541

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.385%

Totals Coverage Status
Change from base Build 539: 0.0%
Covered Lines: 824
Relevant Lines: 911

💛 - Coveralls

@jasonLaster
Copy link

Looks good to me.

@nikolay-borzov
Copy link

Any updates on this? Is there any reason why it's still pending merge?

source-map.d.ts Outdated
@@ -61,6 +61,7 @@ export interface MappingItem {
source: string;
generatedLine: number;
generatedColumn: number;
lastGeneratedColumn?: number;

Choose a reason for hiding this comment

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

I think it should be

 lastGeneratedColumn: number | null;

If I understand code correctly the initial value is null then it can receive number values including Infinity

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

@ericmorand @samccone which do you think is the better typing:

lastGeneratedColumn?: number;
 lastGeneratedColumn: number | null;

Copy link
Contributor

Choose a reason for hiding this comment

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

My interpretation is that lastGeneratedColumn: number | null; is correct, I agree with @nikolay-borzov

lastGeneratedColumn?: number; is equivalent to lastGeneratedColumn: number | undefined; but it is initialized as null.

Choose a reason for hiding this comment

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

Thanks. Happy to update and land.

@ericmorand
Copy link

ericmorand commented Oct 29, 2019

Can someone merge this and release a patch? It is a blocker for most of us using TypeScript.

EDIT: Well, not exactly a blocker, but having to extend MappingItem in our own code isn't exactly pretty:

type ValidMappingItem = MappingItem & {
    lastGeneratedColumn: number | null
}

@jasonLaster
Copy link

Thanks @ericmorand

source-map.d.ts Outdated
@@ -61,6 +61,7 @@ export interface MappingItem {
source: string;
generatedLine: number;
generatedColumn: number;
lastGeneratedColumn?: number;

Choose a reason for hiding this comment

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

This is generated when someone calls `computeColumnSpans` so we mark the property as optional as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants