14

I upgraded TypeScript to 3.7.2 from 3.6.x. And write code using optional chaining. But get strange error

Expression expected.ts(1109)

in (vim, VSCode) IDE, even when build was successful.

enter image description here

2
  • "I upgraded typescript to 3.7.2" from...? Commented Nov 12, 2019 at 14:43
  • 1
    I believe the answer you're looking for can be found here: stackoverflow.com/questions/39668731/… Commented Nov 13, 2019 at 17:11

4 Answers 4

20

Click the version in the bottom right of VS Code.

TS Version

A dropdown will appear at the top with a few options such as "Use VS Code's Version" and "Use Workspace Version".

Select "Use Workspace Version" which will select the version of typescript that tsc is using, typically installed in your devDependencies.

This will automatically add a line to your Workspace Configuration File that looks something like the following:

{
   "typescript.tsdk": "node_modules/typescript/lib"
}
Sign up to request clarification or add additional context in comments.

Comments

1

It could be that your editor isn't using TypeScript 3.7 yet - see if there are options for using the TypeScript version in the TSServer from from your node_modules.

1 Comment

Do you mean options in IDE?
1

You can start using TypeScript 3.7 features in VS Code today by installing the JavaScript and TypeScript Nightly extension.

1 Comment

Or click typescript version number on status bar. select typescript version.
0
import React, { useState } from 'react'
import DatePicker from 'react-native-date-picker'
import newdate 

export default () ={'>'} {
  const [date, setDate] = useState(new Date())

  return <DatePicker date={date} onDateChange={setDate} />
}

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.