mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
5d60697c96
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: jakebailey <[email protected]>
29 lines
808 B
TypeScript
29 lines
808 B
TypeScript
// @target: es2015
|
|
// @declaration: true
|
|
// @exactOptionalPropertyTypes: true
|
|
// @strict: true
|
|
|
|
// Test with default value - should not have undefined
|
|
export class WithDefault {
|
|
constructor(readonly timestamp = new Date()) {}
|
|
}
|
|
|
|
// Test without default value but optional - should have undefined
|
|
export class WithoutDefault {
|
|
constructor(readonly timestamp?: Date) {}
|
|
}
|
|
|
|
// Test with explicit undefined type - should keep it
|
|
export class ExplicitUndefined {
|
|
constructor(readonly timestamp: Date | undefined = new Date()) {}
|
|
}
|
|
|
|
// Test private parameter property with default value
|
|
export class PrivateWithDefault {
|
|
constructor(private timestamp = new Date()) {}
|
|
}
|
|
|
|
// Test public parameter property with default value
|
|
export class PublicWithDefault {
|
|
constructor(public timestamp = new Date()) {}
|
|
} |