I have the following code in my react app:
As you can see onCheck can be undefined. but typescript shows no error and I'm getting a runtime error.
I have to add this prop has no default value.
My tsconfig:
{
"compileOnSave": false,
"compilerOptions": {
"sourceMap": true,
"target": "es5",
"module": "esnext",
"declaration": false,
"noImplicitAny": false,
"experimentalDecorators": true,
"noLib": false,
"jsx": "react",
"noEmitOnError": true,
"moduleResolution": "node",
"lib": [
"DOM",
"ES5",
"ScriptHost",
"ES2015",
"ES2018.Promise"
],
"allowSyntheticDefaultImports": true
},
"exclude": [
"node_modules"
]
}
