add unit test that shows Date is rendered in TS type in interface

This commit is contained in:
Simon Vandel Sillesen 2022-02-10 18:52:57 +01:00
parent f3c34cc452
commit a3c29eb508
4 changed files with 14 additions and 0 deletions

View file

@ -43,6 +43,10 @@ Generated by [AVA](https://avajs.dev).
export function dateToNumber(input: Date): number␊ export function dateToNumber(input: Date): number␊
export function chronoDateToMillis(input: Date): number␊ export function chronoDateToMillis(input: Date): number␊
export function chronoDateAdd1Minute(input: Date): Date␊ export function chronoDateAdd1Minute(input: Date): Date␊
export interface Dates {␊
start: Date␊
end?: Date | undefined | null␊
}␊
export function eitherStringOrNumber(input: string | number): number␊ export function eitherStringOrNumber(input: string | number): number␊
export function returnEither(input: number): string | number␊ export function returnEither(input: number): string | number␊
export function either3(input: string | number | boolean): number␊ export function either3(input: string | number | boolean): number␊

View file

@ -33,6 +33,10 @@ export function returnJsFunction(): (...args: any[]) => any
export function dateToNumber(input: Date): number export function dateToNumber(input: Date): number
export function chronoDateToMillis(input: Date): number export function chronoDateToMillis(input: Date): number
export function chronoDateAdd1Minute(input: Date): Date export function chronoDateAdd1Minute(input: Date): Date
export interface Dates {
start: Date
end?: Date | undefined | null
}
export function eitherStringOrNumber(input: string | number): number export function eitherStringOrNumber(input: string | number): number
export function returnEither(input: number): string | number export function returnEither(input: number): string | number
export function either3(input: string | number | boolean): number export function either3(input: string | number | boolean): number

View file

@ -15,3 +15,9 @@ fn chrono_date_to_millis(input: chrono::DateTime<Utc>) -> i64 {
fn chrono_date_add_1_minute(input: chrono::DateTime<Utc>) -> chrono::DateTime<Utc> { fn chrono_date_add_1_minute(input: chrono::DateTime<Utc>) -> chrono::DateTime<Utc> {
input + Duration::minutes(1) input + Duration::minutes(1)
} }
#[napi(object)]
pub struct Dates {
pub start: chrono::DateTime<Utc>,
pub end: Option<chrono::DateTime<Utc>>,
}