-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Missing type definitions for ol-map
and similar kebab-case components?
#408
Comments
I agree. It would be great to have better type support. However, |
If I understand your reply, you're explaining why I didn't look at the source code enough to understand fully what's going on, but you already seem to have full type definitions for e.g. Wouldn't it look something as simple as this: declare module "vue" {
export interface GlobalComponents {
"ol-view": DefineComponent<InstanceType<typeof Map.OlView>["$props"]>;
}
} And then doing that for all of the tags? Regardless, it seems like the docs should have a little note/warning that explicit imports will work better for TypeScript users, at least for now. |
💯 |
I'll try to make time for a PR. The main difficulty would be knowing all the different components that are supported. It seems like there are many, and I'd worry about missing one, but you could fill in the details. |
Searching in this package's node_modules folder, it seems like some of the kebab-case components are registered as types, e.g.:
(I'm guessing this, or some other kind of injection, is what defines
<ol-options>
as a valid component).But I find no similar injections for
ol-map
andol-view
, for example. Shouldn't there be some type definitions for these? Using these kebab-case-style components, as the getting started docs first suggest, I get no type definitions for them, e.g. VSCode thinks the type ofol-view
isunknown
, and I get no type checking for any of its props.I see you can use explicit imports like
Map.OlView
, which is totally fine by me, and I get proper typing doing it that way. But it seems like either all of the kebab-case components should be defined, or the docs should clearly state that you should use explicit imports for typescript support.Apologies if I am missing something.
package.json
The text was updated successfully, but these errors were encountered: