ds300 / react-native-typescript-transformer

Seamlessly use TypeScript with React Native
MIT License
657 stars 55 forks source link

'Property destructuring pattern expected' at transform when trying to type destructuring #71

Closed creambyemute closed 6 years ago

creambyemute commented 6 years ago

Hey there,

So I have this in createDrawerNavigator from React-navigation:

drawerIcon: ({ tintColor }) => (
                <VectorIcon
                    iconType="ionicon"
                    iconName="ios-home"
                    iconColor={tintColor || Colors.black}
                    iconSize={24}
                />
)

and wanted to type the tintColor like this: { tintColor } : { tintColor: string }.

Unfortunately when trying to run the bundling fails with

error: bundling failed: Error: C:/Users/tst/dev/react/wap3/src/navigation/drawer/DrawerNavigation.tsx (43,27): Property destructuring pattern expected.
    at Object.module.exports.transform (C:\Users\tst\dev\react\wap3\node_modules\react-native-typescript-transformer\index.js:235:15)
    at Object.transformCode [as transform] (C:\Users\tst\dev\react\wap3\node_modules\metro\src\JSTransformer\worker\index.js:253:15)
    at execMethod (C:\Users\tst\dev\react\wap3\node_modules\metro\node_modules\jest-worker\build\child.js:92:29)
    at process.on (C:\Users\tst\dev\react\wap3\node_modules\metro\node_modules\jest-worker\build\child.js:42:7)
    at emitTwo (events.js:126:13)
    at process.emit (events.js:214:7)
    at emit (internal/child_process.js:772:12)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)

TSLint is set to recommended and react and the TSConfig targets es2018 with "lib": ["dom", "es2015", "es2016"],

Am I being stupid and doing it wrong or is there some problem? Because on ReactJS it worked like this.

Cheers

creambyemute commented 6 years ago

Turned out it worked after a machine reboot.

Whatever :-)