-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Generics and TypeScript limited to 4.6.* #17
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@wessberg/di-compiler", | ||
"version": "2.2.6", | ||
"version": "2.2.7", | ||
"description": "A Custom Transformer for Typescript that enables compile-time Dependency Injection", | ||
"scripts": { | ||
"generate:sandhog": "sandhog all --yes", | ||
|
@@ -76,7 +76,7 @@ | |
"crosspath": "^1.0.0", | ||
"ts-node": "^10.8.0", | ||
"npm-check-updates": "^13.0.3", | ||
"typescript": "^4.6.4", | ||
"typescript": "~4.6.4", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this is just the development dependency of TypeScript, and won't restrict library consumers from installing and using TypeScript 4.7. If your intention is to restrict the consumer facing version of TypeScript, it will need to be addressed below it in the package.json file under peer dependencies. However, I would prefer not to do that, and instead look into what the root cause of this apparent regression may be. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree - my intent wasn't to fix the TS 4.7 issue, but to enable the tests to pass (and bring your attention to the 4.7 issue). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I would prefer that we look into this TS 4.7 issue you mention here, maybe in a separate issue |
||
"typescript-3-4-1": "npm:[email protected]", | ||
"typescript-3-5-1": "npm:[email protected]", | ||
"typescript-3-6-2": "npm:[email protected]", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ export function visitCallExpression( | |
factory.createPropertyAssignment( | ||
"identifier", | ||
factory.createStringLiteral( | ||
node.typeArguments[0].getFullText().trim() | ||
node.typeArguments[0].getFirstToken()!.getFullText().trim() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That NonNullAssertion there feels a bit unsafe. I would prefer that we handle it a bit more gracefully, ideally by taking the full text of the first token if it present, and falling back to taking the full text of the first type argument otherwise. // Move it up in a constant
const [firstTypeArgument] = node.typeArguments;
return factory.updateCallExpression(
node,
node.expression,
node.typeArguments,
[
factory.createObjectLiteralExpression([
factory.createPropertyAssignment(
"identifier",
factory.createStringLiteral(
(firstTypeArgument.getFirstToken()?.getFullText() ?? firstTypeArgument.getFullText()).trim()
)
),
]),
]
); |
||
) | ||
), | ||
]), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changelog is actually auto-generated based on the commit log whenever a new version is released. So, unfortunately these two lines would actually be lost. To achieve the same result, you can write commit messages along these lines :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet. I'll back this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!