Open lambrospetrou opened 3 years ago
I also tried running dukat
on its own through the command line, directly giving the Preact type definitions and the results are the same.
➜ npm init -y && npm i -D dukat preact
➜ npx dukat node_modules/preact/src/index.d.ts
nonDeclarations.preact.kt
index.preact.module_preact.kt
jsx.module_preact.kt
jsx.JSXInternal.module_preact.kt
lib.es5.kt
lib.es5.Intl.module_dukat.kt
lib.dom.kt
lib.es2015.iterable.kt
lib.es2015.collection.kt
lib.scripthost.kt
➜ ls
index.preact.module_preact.kt jsx.module_preact.kt lib.es2015.collection.kt lib.es5.Intl.module_dukat.kt lib.scripthost.kt nonDeclarations.preact.kt package.json
jsx.JSXInternal.module_preact.kt lib.dom.kt lib.es2015.iterable.kt lib.es5.kt node_modules package-lock.json
➜ grep -A 5 -e "CacheQueryOptions" ./lib.dom.kt
external interface MultiCacheQueryOptions : CacheQueryOptions {
var cacheName: String?
get() = definedExternally
set(value) = definedExternally
}
The grep
-ed snippet errors with the following in Intellij (see original post):
e: /Users/petrou/dev/github/code-playground/kotlin-preact/build/externals/kotlin-preact/src/lib.dom.kt: (906, 9): 'cacheName' hides member of supertype 'CacheQueryOptions' and needs 'override' modifier
Did you ever figure out a solution for this? I'm having essentially the same problem trying to use Chart.js.
I created a new Kotlin/JS project using
Gradle > Kotlin/JS for browser
from the Intellij wizard.I modified my dependencies to the following:
Then I tried to build the project using the
build
task from Gradle, and it generated the following files:Most of them are OK, but
lib.dom.kt
which is basically a dependency of all the rest has 521 errors (see screenshot).Preact has TypeScript definitions in its own package at https://github.com/preactjs/preact/blob/master/src/index.d.ts.
If it was an issue with the Preact typings I could have a look and fix them, but this seems to be an issue with the core compiler since
lib.dom.kt
contains generic definitions. Should these be even generated since they should have been part of Kotlin/JS anyway?As a sidenote, if I remove the
generateExternals = true
from thepreact
dependency, and I manually define the following naive types I can use Preact but since this basically usesdynamic
for everything it's quite bad, and I don't have type safety.Is there anything else needed as configuration in order to make Dukat generate correct types?
Thanks