if I use dukat to convert js to kt for usage with ...
# javascript
d
if I use dukat to convert js to kt for usage with kotlinjs and react, I get code like:
Copy code
var onItemSelect: (item: T, event: React.SyntheticEvent<HTMLElement>) -> Unit
where do I get the
React.SyntheticEvent<HTMLElement>
from? can't find it anywhere as
React
does not exist...
t
SyntheticEvent
- JS interface (doesn’t exist in runtime) You can declare it in
react
package
Copy code
external interface SyntheticEvent<T: Element>
d
well same for anything that Dukat gives mit React.xxx of something ...
d
so I would dukat "compile" this to a .kt file and include it in my project? (or how these things are supposed to work?)
t
Dukat has known problems And I use following scheme: 1. Generate declarations by Dukat or write itself 2. Add package
react
or other (if Dukat used) 3. Copy declarations to subproject 4. PROFIT
d
well, yes, definitely some problems 🤣
sorry to bother again ... where do I get
PropTypes
stuff from?? e.g.:
Copy code
typealias ValidationMap<T> = PropTypes.ValidationMap<T>
t
HTMLWebViewElement
can be external abstract class (before Kotlin/JS stdlib update) It’s class in any case 🙂 P.S.
react
doesn’t look like valid package
Valid React package -
react
d
no, it's just the warning that it starts with a capital letter (took a capital letter, as I thought it might fix the
React.xxxEvent<...>
stuff