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

fix(language-service): getTsTypeFromBuiltinType() should not include value #33778

Closed
wants to merge 1 commit into from

Conversation

@kyliau
Copy link
Member

kyliau commented Nov 12, 2019

This commit fixes a few issues with helper method
getBuiltInTypeFromTsType.

  1. The function is wrongly named. It should be the other way round.
  2. The ts.Type returned by the function should not contain any value.
    This is because for some data types like Number and String, the
    SourceFile (context.node) is not the correct value. Value is never
    needed for program correctness in this case.
  3. For StringLiteral type, the behavior of (2) means that the type is
    not of String, but rather the string literal itself, which is the entire
    SourceFile.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@kyliau kyliau requested a review from angular/fw-compiler as a code owner Nov 12, 2019
@googlebot googlebot added the cla: yes label Nov 12, 2019
@ngbot ngbot bot added this to the needsTriage milestone Nov 12, 2019
@ayazhafiz ayazhafiz requested a review from alxhub Nov 13, 2019
This commit fixes a few issues with helper method
`getBuiltInTypeFromTsType`.

1. The function is wrongly named. It should be the other way round.
2. The ts.Type returned by the function should not contain any value.
This is because for some data types like Number and String, the
SourceFile (context.node) is not the correct value. Value is never
needed for program correctness in this case.
@kyliau kyliau force-pushed the kyliau:getTsTypeFromBuiltInType branch from 1a321cc to 0922a65 Nov 14, 2019
@kyliau kyliau requested a review from angular/tools-language-service as a code owner Nov 14, 2019
@kyliau kyliau removed request for angular/fw-compiler and alxhub Nov 14, 2019
@kyliau kyliau changed the title fix(compiler-cli): Refactor getTsTypeFromBuiltinType fix(language-service): getTsTypeFromBuiltinType() should not include value Nov 14, 2019
@kyliau

This comment has been minimized.

Copy link
Member Author

kyliau commented Nov 15, 2019

caretaker: I am a member of tools-language-service

@alxhub alxhub closed this in cbb1d9f Nov 15, 2019
alxhub added a commit that referenced this pull request Nov 15, 2019
This commit fixes a few issues with helper method
`getBuiltInTypeFromTsType`.

1. The function is wrongly named. It should be the other way round.
2. The ts.Type returned by the function should not contain any value.
This is because for some data types like Number and String, the
SourceFile (context.node) is not the correct value. Value is never
needed for program correctness in this case.

PR Close #33778
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.