Cannot type TagInput onChange as string[]
See original GitHub issueEnvironment
- Package version(s):
"@blueprintjs/core": 3.15.1
- Browser and OS versions: N/A
Minimal repro: https://codesandbox.io/s/2pz12p278r?fontsize=14
Steps to reproduce
- Use
<TagInput />
withstrict: true
andonChange: (newValues: string[]) => ...
Actual behavior
Type '(newValues: string[]) => void' is not assignable to type '(values: ReactNode[]) => boolean | void'.
Types of parameters 'newValues' and 'values' are incompatible.
Type 'ReactNode[]' is not assignable to type 'string[]'.
Type 'ReactNode' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.ts(2322)
Expected behavior
A way of typing the onChange
callback without getting type errors.
Possible solution
Maybe <TagInput<string[]> />
? Or maybe this is fixable in the current typings.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Can't type in React input text field - Stack Overflow
It needs to be onChange in JSX. <input type="text" value={this.props.searchString} ref="searchStringInput ...
Read more >Building a tag input field component for React - LogRocket Blog
Ever wonder how to build a tag input field component for your React app? Here's a quick tutorial to show you exactly how...
Read more ><input type="text"> - HTML: HyperText Markup Language | MDN
A string representing the text contained in the text field. Events, change and input. Supported Common Attributes, autocomplete , list , ...
Read more >ngx-chips - npm
Tag Input Component for Angular Build Status npm version ... String that sets the placeholder of the input for entering new terms.
Read more >Form Tags | Components - BootstrapVue
disableAddButton, Boolean, Will be true if the tag(s) in the input cannot be added (all invalid ... form, String, The form attribute for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Could a generic component with
React.ReactNode[]
default work? I think that would be a non-breaking change.There have been some recent changes to the TagInput API… closing this issue in favor of https://github.com/palantir/blueprint/issues/4390