Converter icon indicating copy to clipboard operation
Converter copied to clipboard

Parse error in method with default agrument

Open mobilemindtech opened this issue 5 months ago • 0 comments

Hi,

Hi, I had an error while transpiling this code. So I removed the = {} and it compiled without error. Is this a bug?

Code with compilation error:

export class RootLayout extends GridLayout { // line 7
	open(view: View, options: RootLayoutOptions = {}): Promise<void>;
	close(view: View, exitTo?: TransitionAnimation): Promise<void>;
	topmost(): View;
	bringToFront(view: View, animated?: boolean): Promise<void>;
	closeAll(): Promise<void[]>;
	getShadeCover(): View;
	openShadeCover(options: ShadeCoverOptions = {}): Promise<void>;
	closeShadeCover(shadeCoverOptions: ShadeCoverOptions = {}): Promise<void>;
}

Stacktrace

[error] 2025-07-28T14:13:12.022517974Z Phase1ReadTypescript.scala:72 message Couldn't parse: Parse error at 7.14 end of input expected [id => @nativescript/core, thread => 313, phase => typescript, file => ../layouts/root-layout/index.d.ts]com.olvind.logging.Logger$LoggedException: Couldn't parse: Parse error at 7.14 end of input expected
	at com.olvind.logging.Logger$LoggingOps$.fatal$extension(Logger.scala:178)
	at org.scalablytyped.converter.internal.importer.Phase1ReadTypescript.$anonfun$apply$4(Phase1ReadTypescript.scala:72)
	at org.scalablytyped.converter.internal.importer.Lazy$$anon$1.get(Lazy.scala:30)
	at org.scalablytyped.converter.internal.importer.Phase1ReadTypescript.$anonfun$apply$22(Phase1ReadTypescript.scala:198)
	at org.scalablytyped.converter.internal.maps$MapOps$.mapNotNone$extension(maps.scala:93)
	at org.scalablytyped.converter.internal.importer.Phase1ReadTypescript.apply(Phase1ReadTypescript.scala:198)

Code without compilation error:

export class RootLayout extends GridLayout {
	open(view: View, options: RootLayoutOptions): Promise<void>;
	close(view: View, exitTo?: TransitionAnimation): Promise<void>;
	topmost(): View;
	bringToFront(view: View, animated?: boolean): Promise<void>;
	closeAll(): Promise<void[]>;
	getShadeCover(): View;
	openShadeCover(options: ShadeCoverOptions): Promise<void>;
	closeShadeCover(shadeCoverOptions: ShadeCoverOptions): Promise<void>;
}

mobilemindtech avatar Jul 28 '25 20:07 mobilemindtech