In Typescript, options parameter is mandatory.
See original GitHub issueThe constructor of SimpleReactValidator set options as an empty object by default.
It’s the same for theses methods :
- messageWhenPresent
- messageAlways
- message
But, in Typescript, the value for options is mandatory.
this.validator = new SimpleReactValidator({});
or
this.validator.message("title", this.state.title, 'required', {});
index.d.ts should handle nullable for options so we can use it like this :
this.validator = new SimpleReactValidator();
or
this.validator.message("title", this.state.title, 'required');
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
TypeScript Optional Parameters
In this tutorial, you will learn how to use the TypeScript optional parameters for functions.
Read more >How to pass optional parameters while omitting some other ...
We can get this functionality in TypeScript by adding a ? to the end of parameters we want to be optional. For example,...
Read more >Typescript Optional Parameters Guide - DotNetPattern
TypeScript is a strong typed language. When we declare parameters for a function then all the parameters are required and client has to...
Read more >Provide the syntax for optional parameters in TypeScript
In Typescript, “?” represents optional parameters. We use optional parameters when it's not mandatory for that parameter to have a value or ...
Read more >TypeScript Optional Parameters | Working and Examples
We should note that whenever we are making any parameter as an optional parameter in the function it is a must that any...
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 FreeTop 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
Top GitHub Comments
Excellent! I’m on it.
Deploying in latest version.