This is rather odd. I am using visual studio code, having set a react-native with typescript (react-native + nativebase + typescript). While intellisense and type checking works in general, I am facing some troubles with jsx intellisense, code suggestions do not appear for any jsx props.
What I mean is that usually when you tape ctrl+space in a jsx element, vs code displays available props.
This does not works. In the above example the suggestions offered are not the available props of this jsx element <Content>. The consequence is that errors in props listing are not picked up by compiler. For example this code:
is not flagged as an error even though the prop foo does not exists in the definition of the Content component. It has not been defined no where. This is the first time it appears in the code. Yet compiler does not flag it as error.
Typescript is supposed to make javascript typed and pick compile time error.
Here is my tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"allowJs": true,
"jsx": "react",
"rootDir": "modules",
"sourceMap": true,
"noImplicitAny": false,
},
"filesGlob": [
"modules/**/*.ts",
"modules/**/*.tsx",
"typings/**/*.d.ts"
],
"exclude": [
"node_modules"
]
}
Also typescript is properly set in visual studio code as shown on the task bar:
You can see that Typescript with react is set. Also typings are properly referenced in my tsx file:
/// <reference path="../typings/index.d.ts" />
import * as React from 'react';
import { View, Text } from 'react-native';
So how can I get typescript to properly suggest props on jsx elements with ctrl + space and more seriously why is typescript not detecting an error when I use props not defined for a given component? Is it somethings with typings I don't get or is there a setting in the tsconfig.json?
Thank you for your valuable help.


