RainwayApp / node-clangffi

Generate Typescript FFI bindings for C/C++ libraries using libclang and ffi-napi.
MIT License
7 stars 1 forks source link

Use `UnderlyingType` for *Type exports #28

Closed bengreenier closed 2 years ago

bengreenier commented 2 years ago

There is still some inconsistency between what a *Def stores, and what a *Type represents. To avoid this, it's probably better to use UnderlyingType from ref-napi rather than generating it ourselves. E.g:

type MyStructType = UnderlyingType<typeof MyStructDef>;

instead of

type MyStructType = StructObject<MyStruct>;

since the TS typing and the coerced ref-napi NamedType may not align exactly.