-
Notifications
You must be signed in to change notification settings - Fork 109
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
Update TypeScript to latest #630
Conversation
registerHelper('js-string-escape', jsStringEscape); | ||
registerHelper('join', function (list, connector) { | ||
Handlebars.registerHelper('js-string-escape', jsStringEscape); | ||
Handlebars.registerHelper('join', function (list, connector) { |
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 API docs only show that kind of usage, and registerHelper
accesses this.
. Not sure why it worked before, but as soon as the compilation output from a new TS versions changed this be like (0, handlebars_1.registerHelper)('join', ...)
, it would lose access to this
.
@@ -192,7 +192,7 @@ export default class Analyzer extends Funnel { | |||
try { | |||
transformSync(source, options); | |||
} catch (err) { | |||
if (err.name !== 'SyntaxError') { | |||
if (err instanceof Error && err.name !== 'SyntaxError') { |
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.
I understand what you're doing here but I don't like the idea of introducing a subtle behaviour change just to work around types here. I would prefer if you worked around the types like you did later in the PR. Something like (err as unknown as {name: string})
? but don't quote me on it 😂
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.
But what's the change in behaviour here? In case of a SyntaxError
it will always be an instance of Error
, right? And if it's not a SyntaxError
, then the if condition will not be hit either way. If feel this is the cleaner way to do this than to override the types, given that TS is actually right here.
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.
@mansona 👆😏
Hope this will unblock #623 (comment)