Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Nov 5, 2024
1 parent a1bab50 commit 0f31a95
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 61 deletions.
61 changes: 61 additions & 0 deletions fixtures/input/class.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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)
// }
// }

// export class Result<T, E extends Error> {
// constructor(
// readonly value: T | null = null,
// readonly error: E | null = null
// ) {}

// isOk(): this is { readonly value: T } {
// return this.value !== null && this.error === null;
// }

// isErr(): this is { readonly error: E } {
// return this.error !== null && this.value === null;
// }
// }
10 changes: 10 additions & 0 deletions fixtures/output/class.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export declare class CustomError extends Error {
constructor(
message: string,
public readonly code: number,
public readonly metadata: Record<string, unknown>
) {
super(message)
this.name = 'CustomError'
}
}
61 changes: 0 additions & 61 deletions fixtures/wip/class.ts

This file was deleted.

0 comments on commit 0f31a95

Please sign in to comment.