-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add typescript friendly mixins #85
Conversation
// routeExit(currentNode: RouteTreeNode, nextNode: RouteTreeNode | undefined, routeId: string, context: Context): Promise<boolean | void>; | ||
// } | ||
|
||
function animatedRoutingMixin<T extends Constructor<LitElement>>(Superclass:T, className:string) { |
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.
Should this be specific to LitElement
?
function animatedRoutingMixin<T extends Constructor<LitElement>>(Superclass:T, className:string) { | |
function animatedRoutingMixin<T extends Constructor<HTMLElement>>(Superclass:T, className:string) { |
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 would think so, but there are some downstream (platform-tools) components that extend this mixin that complain when using LitElement HTMLElement. I know it's not ideal to be restricted to LitElement, but I don't believe that we'll be using any other library for the foreseeable future.
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 commented below but without the LitElement as the extended class, it causes typescript errors when using the lifecycle methods. @barronhagerman @jrobinson01
routeEnter(currentNode: RouteTreeNode, nextNodeIfExists: RouteTreeNode | undefined, routeId: string, context: Context): Promise<boolean | void>; | ||
routeExit(currentNode: RouteTreeNode, nextNode: RouteTreeNode | undefined, routeId: string, context: Context): Promise<boolean | void>; | ||
} | ||
const RoutingMixin = <T extends Constructor<LitElement>>(superclass: T) => { |
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.
Same here. Should this be specific to LitElement
?
const RoutingMixin = <T extends Constructor<LitElement>>(superclass: T) => { | |
const RoutingMixin = <T extends Constructor<HTMLElement>>(superclass: T) => { |
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 was something we discovered in origin. If we don't use LitElement as the super class we get linter errors when using the lifecycle methods like connectedCallback etc
https://lit.dev/docs/composition/mixins/#mixins-in-typescript
|
adds typescript ports of the routing mixins:
routing.mixin.ts and animated-routing.mixin.ts
This PR also includes the built .js versions of those files. These might play nicer with projects that are not using typescript, but are using tsc and jsdoc. This PR should not affect projects using closure compiler.