typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

d.ts content different with tsc

Open futurist opened this issue 6 months ago • 1 comments

with below code:

export class X {
	static readonly ID = 'XXX';
}

generated d.ts file with below different:

  • tsc
export declare class X {
	static readonly ID = 'XXX';
}
  • tsgo
export declare class X {
	static readonly ID: string;
}

version: @typescript/[email protected]

futurist avatar May 30 '25 13:05 futurist

export class HistoryNavigator<T> implements INavigator<T> {
	private _limit: number;
	private _navigator!: ArrayNavigator<T>;

	constructor(
		private _history: IHistory<T> = new Set(),
		limit: number = 10,
	) {
		this._limit = limit;
		this._onChange();
		if (this._history.onDidChange) {
			this._history.onDidChange(() => this._onChange());
		}
	}
}

the d.ts diff is ( tsc vs tsgo ):

<   private _navigator;
<   constructor(_history?: IHistory<T>, limit?: number);
---
>   private _navigator!;
>   constructor(_history?: IHistory<T> | undefined, limit?: number);

seems like tsgo will add | undefined when the argument is optional.

futurist avatar May 30 '25 13:05 futurist

any update?

futurist avatar Jul 19 '25 06:07 futurist