7

I'm getting this error:

vscode screenshot

Same error when I try to compile:

c:\...\tsx-test>ntsc app/main.tsx
app/components/Note.tsx(13,31): error TS1180: Property destructuring pattern expected.

But I don't know what it's expecting. What's the property syntax?

I'm pretty sure this works as-is in ES6. Is the syntax different in TypeScript?

Note that I'm using TypeScript 1.5.3.

mpen
  • 272,448
  • 266
  • 850
  • 1,236

1 Answers1

10

I'm pretty sure this works as-is in ES6.

the {a, b, ...rest} = props pattern is supported by TypeScript now. Just update to the latest compiler and it will work without error.

More

Some docs on the TypeScript destructuring:

http://basarat.gitbook.io/typescript/content/docs/destructuring.html

basarat
  • 261,912
  • 58
  • 460
  • 511