diff --git a/examples/napi/__test__/typegen.spec.ts.md b/examples/napi/__test__/typegen.spec.ts.md index 6f3cce0f..4e6eb413 100644 --- a/examples/napi/__test__/typegen.spec.ts.md +++ b/examples/napi/__test__/typegen.spec.ts.md @@ -43,6 +43,10 @@ Generated by [AVA](https://avajs.dev). export function dateToNumber(input: Date): number␊ export function chronoDateToMillis(input: Date): number␊ export function chronoDateAdd1Minute(input: Date): Date␊ + export interface Dates {␊ + start: Date␊ + end?: Date | undefined | null␊ + }␊ export function eitherStringOrNumber(input: string | number): number␊ export function returnEither(input: number): string | number␊ export function either3(input: string | number | boolean): number␊ diff --git a/examples/napi/__test__/typegen.spec.ts.snap b/examples/napi/__test__/typegen.spec.ts.snap index d07cb6c3..335738c1 100644 Binary files a/examples/napi/__test__/typegen.spec.ts.snap and b/examples/napi/__test__/typegen.spec.ts.snap differ diff --git a/examples/napi/index.d.ts b/examples/napi/index.d.ts index 9f9da35d..2a6ae7e7 100644 --- a/examples/napi/index.d.ts +++ b/examples/napi/index.d.ts @@ -33,6 +33,10 @@ export function returnJsFunction(): (...args: any[]) => any export function dateToNumber(input: Date): number export function chronoDateToMillis(input: Date): number export function chronoDateAdd1Minute(input: Date): Date +export interface Dates { + start: Date + end?: Date | undefined | null +} export function eitherStringOrNumber(input: string | number): number export function returnEither(input: number): string | number export function either3(input: string | number | boolean): number diff --git a/examples/napi/src/date.rs b/examples/napi/src/date.rs index d1d00ca5..f13ee76a 100644 --- a/examples/napi/src/date.rs +++ b/examples/napi/src/date.rs @@ -15,3 +15,9 @@ fn chrono_date_to_millis(input: chrono::DateTime) -> i64 { fn chrono_date_add_1_minute(input: chrono::DateTime) -> chrono::DateTime { input + Duration::minutes(1) } + +#[napi(object)] +pub struct Dates { + pub start: chrono::DateTime, + pub end: Option>, +}