Ts2kt for react fails


#1

Hi,

I’ve tried to run ts2kt against react.d.ts. Fails.
Would be great if npm integration was seamless.
For all supported build systems: Gradle & Maven

Output of ts2kt further below.

Thanks and regards,
Fuzz.

uzz@quantum MINGW64 ~/dev/source/reactx/example/example-web/src/main/kotlin/io/dazraf/reactx/example/react (master)
$ ts2kt react.d.ts
Converting react.d.ts
ts2kt: “NamespaceExportDeclaration” kind unsupported yet here! (react.d.ts:28:16 to 29:27)
ts2kt: “Identifier” kind unsupported yet here! (react.d.ts:140:20 to 140:30)
ts2kt: “Identifier” kind unsupported yet here! (react.d.ts:144:20 to 144:29)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:199:32 to 199:40)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:199:48 to 199:77)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:220:32 to 220:40)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:220:48 to 220:68)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:222:39 to 222:47)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:222:55 to 226:6)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:236:20 to 236:21)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:236:23 to 236:46)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:237:40 to 238:61)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:238:62 to 238:88)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:238:88 to 239:38)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:239:38 to 240:43)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:240:43 to 241:35)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:241:35 to 242:30)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:245:36 to 252:6)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:254:43 to 254:44)
ts2kt: “ExpressionStatement” kind unsupported yet here! (react.d.ts:254:52 to 257:6)
C:\Users\fuzz\AppData\Roaming\npm\node_modules\ts2kt\node_modules\typescript\lib\typescript.js:5738
return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ / && identifier.charCodeAt(1) === 95 / _ / && identifier.charCodeAt(2) === 95 / _ */ ? identifier.substr(1) : identifier;
^

TypeError: Cannot read property ‘length’ of undefined
at Object.unescapeIdentifier (C:\Users\fuzz\AppData\Roaming\npm\node_modules\ts2kt\node_modules\typescript\lib\typescript.js:5738:26)
at TsInterfaceToKt.TsClassifierToKt.visitPropertyDeclaration_qnxew1$ (C:\Users\fuzz\AppData\Roaming\npm\node_modules\ts2kt\ts2kt.js:2062:50)
at visitNode (C:\Users\fuzz\AppData\Roaming\npm\node_modules\ts2kt\ts2kt.js:1856:15)
at C:\Users\fuzz\AppData\Roaming\npm\node_modules\ts2kt\ts2kt.js:1811:7
at visitEachNode (C:\Users\fuzz\AppData\Roaming\npm\node_modules\ts2kt\node_modules\typescript\lib\typescript.js:8343:30)
at forEachChild (C:\Users\fuzz\AppData\Roaming\npm\node_modules\ts2kt\node_modules\typescript\lib\typescript.js:8429:24)
at forEachChild_0 (C:\Users\fuzz\AppData\Roaming\npm\node_modules\ts2kt\ts2kt.js:1815:5)
at ObjectTypeToKotlinTypeMapperImpl.getKotlinTypeForObjectType_29gnwt$ (C:\Users\fuzz\AppData\Roaming\npm\node_modules\ts2kt\ts2kt.js:2877:5)
at toKotlinType_1 (C:\Users\fuzz\AppData\Roaming\npm\node_modules\ts2kt\ts2kt.js:1580:23)
at toKotlinType_2 (C:\Users\fuzz\AppData\Roaming\npm\node_modules\ts2kt\ts2kt.js:1632:16)


#2

Hi!

I’ve updated ts2kt package to v0.0.14 and now it should work, at least should not crash :slight_smile:


#3

Awesome, thanks! I’ll give it a try and will report back