-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
feat(types): RouterConfig for multiple components (#3217) #3218
Conversation
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.
Thanks for this!
6d3cb0b
to
e462bb2
Compare
e462bb2
to
9a3349f
Compare
Done |
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.
Thanks a lot. Let me just move the children next to components as well and I will merge this
The associated commit broke my ts use case I have a custom interface for my Router configuration, e.g.: // file: routes.ts
// ...
import { RouteConfig } from 'vue-router'
interface MyRouteConfig extends RouteConfig {
meta?: MyMeta; // <- defined elsewhere
}
export const routes: Array<MyRouteConfig> = [
// ... the usual route configuration, with my added meta-thing
] After the commit, the However, typescript can't extend from union types, because "An interface can only extend an object type or intersection of object types with statically known members" What I really need is to extends the new |
That was a case I missed. They are trying to fix it in #3234. Personally I think that using a generic |
FYI, adding a generic to the type should go through an RFC because is not that simple of a change |
Closes #3217
The test demonstrates that with correct typings, typescript is able to infer that route is of type
Route
on its own.