Typescript not finding basic javascript methods
See original GitHub issuecode-server
version: 1.939- OS Version: OSX 10.13.6, Ubuntu 18.04
Description
When loading an react application with typescript, code-server throws error on: Object => cannot find name ‘Object’ Function => cannot find name ‘Function’ document => cannot find name ‘document’, even thought dom is included in the lib of tsconfig bind => bind does not exist on type ( id: string )=>void, is not recognizing that functions have the bind prototype filter => filter does not exist on type {} event thought the variable is initialize as an array and type as an string[]
For context, the application is a react application created using create-react-app tsconfig is the one that came prebuild:
This was tested on both Mac OSX 10.13.6 and Ubuntu 18.04 with 2 different react apps.
Note that it still compiles as expected, but the intellisense highlighter is reporting it as an error One the desktop visual studio code, it will compile and intellisense will not highlight these items
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve"
},
"include": [
"src"
]
}
Steps to Reproduce
- run create-react-app to generate a react app with typescript
npx create-react-app bugs --typescript
- create a interface or variable with type Object or Function
export interface iProps{
test: Object;
onChange: Function;
}
- create a function, then call it with bind
const foo = ( echo:string ):string => echo;
foo.bind( this )( 'no' );
- create an array and use the filter method
const foo: string[] = [ 'yes', 'no', 'maybe' ];
const yes = foo.filter( ( answer: string ):boolean => answer === 'yes' );
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6
@josephRice Thanks! bumping it down to 3.3.3333 and 3.1.1 worked, just had to also manually switch the version on the vs code bottom toolbar , since 3.4.3 still gets provided by vs code even if a new version is installed in the node module.
Oh never mind, it was answered 😃 I guess this issue can be closed?