diff --git a/fixtures/tbd/function.ts b/fixtures/input/function.ts similarity index 100% rename from fixtures/tbd/function.ts rename to fixtures/input/function.ts diff --git a/fixtures/output/function.d.ts b/fixtures/output/function.d.ts new file mode 100644 index 0000000..2831bba --- /dev/null +++ b/fixtures/output/function.d.ts @@ -0,0 +1,26 @@ +import type { BunPlugin } from 'bun'; +import type { DtsGenerationOption } from '@stacksjs/dtsx'; +export declare function fetchUsers(): Promise; +export declare function getProduct(id: number): Promise>; +export declare function authenticate(user: string, password: string): Promise; +export declare function dts(options?: DtsGenerationOption): BunPlugin; +declare const cwd: unknown; +declare const c: unknown; +declare const configPath: unknown; +declare const importedConfig: unknown; +declare const loadedConfig: unknown; +export declare function processData(data: string): string; +export declare function processData(data: number): number; +export declare function processData(data: boolean): boolean; +export declare function processData(data: T): T; +export declare function processData(data: unknown): unknown; +declare const results: unknown; +export declare function isUser(value: unknown): value is User; +export declare function extractFunctionSignature(declaration: string): FunctionSignature; +declare const cleanDeclaration: unknown; +declare const functionPattern: unknown; +declare const functionMatch: unknown; +declare const name: unknown; +declare const genericsResult: unknown; +declare const paramsResult: unknown; +declare const match: unknown; diff --git a/fixtures/tbd/class.ts b/fixtures/tbd/class.ts deleted file mode 100644 index e54e93f..0000000 --- a/fixtures/tbd/class.ts +++ /dev/null @@ -1,11 +0,0 @@ -// TODO: Complex Error Handling -// export class CustomError extends Error { -// constructor( -// message: string, -// public readonly code: number, -// public readonly metadata: Record -// ) { -// super(message) -// this.name = 'CustomError' -// } -// } diff --git a/fixtures/wip/class.ts b/fixtures/wip/class.ts new file mode 100644 index 0000000..ce12b47 --- /dev/null +++ b/fixtures/wip/class.ts @@ -0,0 +1,46 @@ +export class CustomError extends Error { + constructor( + message: string, + public readonly code: number, + public readonly metadata: Record + ) { + super(message) + this.name = 'CustomError' + } +} + +export class CustomErrorWithMethod extends CustomError { + logError() { + console.error(`[${this.code}] ${this.message}`) + } +} + +export class CustomErrorWithMethodAndType extends CustomError { + logError(): void { + console.error(`[${this.code}] ${this.message}`) + } + + getError(): Error { + return this + } +} + +export class CustomErrorWithMethodAndTypeAndReturn { + constructor( + private message: string, + public readonly code: number, + public readonly metadata: Record + ) { + this.message = message + this.code = code + this.metadata = metadata + } + + logError(): void { + console.error(`[${this.code}] ${this.message}`) + } + + getError(): Error { + return new Error(this.message) + } +} diff --git a/fixtures/tbd/enum.ts b/fixtures/wip/enum.ts similarity index 100% rename from fixtures/tbd/enum.ts rename to fixtures/wip/enum.ts diff --git a/fixtures/tbd/exports.ts b/fixtures/wip/exports.ts similarity index 100% rename from fixtures/tbd/exports.ts rename to fixtures/wip/exports.ts diff --git a/fixtures/tbd/interface.ts b/fixtures/wip/interface.ts similarity index 100% rename from fixtures/tbd/interface.ts rename to fixtures/wip/interface.ts diff --git a/fixtures/tbd/module.ts b/fixtures/wip/module.ts similarity index 100% rename from fixtures/tbd/module.ts rename to fixtures/wip/module.ts diff --git a/fixtures/tbd/type.ts b/fixtures/wip/type.ts similarity index 100% rename from fixtures/tbd/type.ts rename to fixtures/wip/type.ts