Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Nov 2, 2024
1 parent fa2ea83 commit 01dc5cb
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 11 deletions.
File renamed without changes.
26 changes: 26 additions & 0 deletions fixtures/output/function.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { BunPlugin } from 'bun';
import type { DtsGenerationOption } from '@stacksjs/dtsx';
export declare function fetchUsers(): Promise<ResponseData>;
export declare function getProduct(id: number): Promise<ApiResponse<Product>>;
export declare function authenticate(user: string, password: string): Promise<AuthResponse>;
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<T extends object>(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;
11 changes: 0 additions & 11 deletions fixtures/tbd/class.ts

This file was deleted.

46 changes: 46 additions & 0 deletions fixtures/wip/class.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export class CustomError extends Error {
constructor(
message: string,
public readonly code: number,
public readonly metadata: Record<string, unknown>
) {
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<string, unknown>
) {
this.message = message
this.code = code
this.metadata = metadata
}

logError(): void {
console.error(`[${this.code}] ${this.message}`)
}

getError(): Error {
return new Error(this.message)
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 01dc5cb

Please sign in to comment.