-
Notifications
You must be signed in to change notification settings - Fork 1k
[labs/analyzer] Require a TypeScript object to construct an Analyzer #4029
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
Conversation
🦋 Changeset detectedLatest commit: 63bc673 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Tachometer Benchmark ResultsSummarynop-update
render
update
update-reflect
Resultslit-element-list
render
update
update-reflect
lit-html-kitchen-sink
render
update
nop-update
lit-html-repeat
render
update
lit-html-template-heavy
render
update
reactive-element-list
render
update
update-reflect
|
01401c4 to
f68c4a1
Compare
| path: this.path, | ||
| typescript: this.typescript, | ||
| getProgram: this._getProgram, | ||
| } = init); |
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.
Is this syntax any better? a sequence of assignments seems more legible and more likely to be optimized by VMs
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.
In size constrained libraries it removes a dereference per property, and I've started to like the look of the pattern. It's also nice for code-completion when you add a new option to the init interface.
| */ | ||
| const parseType = (typeString: string): ts.TypeNode | undefined => { | ||
| // TODO (justinfagnani): This would probably be a bit cleaner as an instance | ||
| // method on Analyzer now. |
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.
There will never be an easier time to make breaking changes than now
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.
This wouldn't be a breaking change, and would add public API, so I wanted to be conservative.
There are a lot of potential cleanups I saw while in here, I also needed to limit the changes to just the relevant ones to keep things reviewable.
Fixes #4018
Builds on #3980
Implements a BYOTS pattern for the analyzer. This PR does not update TypeScript yet, but I think we should update it to 5.0 as a follow up.
I implemented this fairly mechanically, bottom-up, adding a typescript arg to functions that needed it, and re-using the analyzer argument if there already was one. The end result might be a little inconsistent, but functions generally take only what they need. I think stylistically it might be nice to most the analyzer argument first, as would be done with curry-compatible style (put the varying arguments last).