node-addon-examples icon indicating copy to clipboard operation
node-addon-examples copied to clipboard

Add .d.ts files in samples.

Open UrielCh opened this issue 1 year ago • 1 comments

Hi,

Native Import in NodeJS do not provide any Typing by default.

src/1-getting-started/6_object_wrap/node-addon-api/myobject.cc register a class MyObject having a plusOne method. but coding in addon.js will not give access to any typing.

My I open a PR to add d.ts that contains somthink like:

class MyObject {
    public plusOne(): number;
    public value(): number;
    public multiply(num?: number): number;
}

UrielCh avatar Sep 05 '24 16:09 UrielCh

I have a PR for that:

https://github.com/nodejs/node-addon-examples/pull/538

UrielCh avatar Sep 09 '24 15:09 UrielCh