-
Notifications
You must be signed in to change notification settings - Fork 53
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
Using 'title' in a Child Route causes a Type Error #691
Comments
Ok, so one way to work around this issue is to cast the child object to
But why is this necessary? |
I think this is not an issue in export type ViewRoute = Route & {
title?: string;
icon?: string;
children?: ViewRoute[];
}; The This is why it works when you explicitly cast the type of children. I also ran into this once and then solved it by doing something like Just now when searching for the problem again I found this https://stackoverflow.com/questions/51591792/typescript-overwrite-a-field-from-an-extended-interface and it seems that it's possible to fix the issue without explicit casting by changing the export type ViewRoute = Omit<Route, 'children'> & {
title?: string;
icon?: string;
children?: ViewRoute[];
}; I just tried and using this it gets rid of the error that would otherwise happen when you add |
I created an issue about this in the private repository of start.vaadin.com. This public issue could probably be moved to https://github.com/vaadin/vaadin.com/issues |
Vaadin 21.0.2, @vaadin/router 1.7.4 here. With a route configuration like this
I get the following compile error
The error disappears when I remove the
title: 'Bar'
line.ViewType
type seems to suggest so.The text was updated successfully, but these errors were encountered: