2

next.js npm run dev keeps failing with this optional property in tsx file:

Syntax error: Unexpected token 44 | 45 | type State<T_HT> = { > 46 | ghostHighlight: ?{ | ^ 47 | position: T_ScaledPosition 48 | }, 49 | isCollapsed: boolean, 

what causes this, how to resolve this

0

2 Answers 2

2

Optional properties, question mark should come before colon as below

ghostHighlight ?: { position: T_ScaledPosition } 
Sign up to request clarification or add additional context in comments.

2 Comments

thank you so much. I am new to typescript, and I was converting some js to ts
No problem, good luck at that. Don't forget to mark it as answer if it helped you ;)
1

Question mark position is wrong here. The question mark should be like this

 45 | type State<T_HT> = { > 46 | ghostHighlight?: { 47 | position: T_ScaledPosition 48 | }, 49 | isCollapsed: boolean, 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.