Skip to content

Uninitialized properties without exclamation mark should cause to compile error #482

Closed
@MaxGraey

Description

@MaxGraey
class Foo {
  notAssigned: f64; // <-- should be compile error "Property 'notAssigned' has no initializer and is not definitely assigned in the constructor."
  nonAssignedButIgnored!: f64; // has exclamation mark so valid and init as zero (default)
}
class Foo {
  notAssigned: f64; // ok! Now assigned in constructor
  nonAssignedButIgnored!: f64; // ok!
  constructor() {
     this.notAssigned = 0;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions