This repository was archived by the owner on Nov 9, 2024. It is now read-only.
Use KnownProps to ignore index signature #137
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #134
This ignores
[key: string]: anyfromPropsinterface, allowing autocomplete and type validation to actually work in this package. (It works fine intippy.jscore [autocomplete & types validation works] but not when extended here, idk why I'm not good with TS)Then we need to add back in the index signature for each of the extended interfaces so plugin props don't error (without needing to make your own type).
To make your own type for plugin props like
followCursorwhich don't exist onProps, you need to make your own function type, like this, I think:BUT since we're adding
[key: string]: anyto each of the extended interfaces, you don't need it just like intippy.js- you just won't get autocompletion & type validation. So it's backwards-compatible with 3.0.0 and 3.0.1.TL;DR
[key: string]: anybreaks autocomplete & type validation for all the known/declared types, so we need to only extend the KnownProps version of it[key: string]: anyto the extended interfaces to prevent unknown props (e.g. for plugins) from erroring. The user can create strict types for plugin props if they wish to. If they pass an unknown prop, there's a runtime DEV warning telling them that, instread of compile time TS warning (for JS users).TippyProps,TippySingletonProps, andUseSingletonPropsinterfaces.