You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I first wrote the constructor declarations with defaults, VSCode didn't rais any errors, but after reopen it and declaring interfaces it raised: A parameter initializer is only allowed in a function or constructor implementation.ts(2371)
VSCode isn't consistent with this notification.
class Point2D {
// constructor (x: number = 0, y: number = 0)
// replace with
constructor (x?: number, y?: number)
}
// all this initialization are good
Point2D p0 = new Point2D() // x and y initialization are handled by the real implementation
Point2D p1 = new Point2D(1) // y initialization is handled by the real implementation
Point2D p2 = new Point2D(1, 1)
The text was updated successfully, but these errors were encountered:
When I first wrote the constructor declarations with defaults, VSCode didn't rais any errors, but after reopen it and declaring interfaces it raised:
A parameter initializer is only allowed in a function or constructor implementation.ts(2371)
VSCode isn't consistent with this notification.
The text was updated successfully, but these errors were encountered: