-
Notifications
You must be signed in to change notification settings - Fork 25
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
Inspiration - add create mapping and checker script #5139
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR! 🎉 We've deployed an automatic preview for this PR - you can see your changes here:
Note The build needs to finish before your changes are deployed. |
type LitElementConstructor = Constructor<{}>; | ||
type LitElementClassType = Constructor<{}>; | ||
type ReactiveElementConstructor = Constructor<{}>; | ||
type ReactiveElementClassType = Constructor<{}>; |
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.
Typing all the template types to Constructor<{}>
so that the errors are pushed to the check-html-element-tag-types.ts file
"strictFunctionTypes": false, | ||
"moduleResolution": "bundler", | ||
"maxNodeModuleJsDepth": 3, | ||
"skipLibCheck": true |
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.
Skip errors in *.d.ts
files
"strict": true, | ||
"strictFunctionTypes": false, | ||
"moduleResolution": "bundler", | ||
"maxNodeModuleJsDepth": 3, |
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.
Need this to include the localize mixin from intl: https://github.com/BrightspaceUI/intl/blob/main/lib/localize.js#L17
@@ -0,0 +1,14 @@ | |||
/** Generated from {@link ../tools/create-mapping.sh} */ | |||
import { LitElement } from 'lit'; |
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 import is needed to extend the HTMLElementTagNameMap instead of defining it. Not sure if there is a better way to do this.
0c76e6c
to
6acaee2
Compare
jsconfig.json
Outdated
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.
jsconfig.json is something that IDEs will pick up and use to add typing information.
declare global { | ||
interface HTMLElementTagNameMap { | ||
// Components with export class...extends LitElement | ||
'd2l-build-info': import('../index.js').BuildInfo; |
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 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.
After this, a CI step can be created to automatically update the mapping as needed. Then, adding new components to the map should be very simple. Just add an export or @typedef
, then a PR will automatically be created to add it, and the lint step will ensure that the mixins are being used correctly.
e841e4f
to
05e2774
Compare
No description provided.