Skip to content

StrictPropertyInitialization does not understand calls to helpers #21132

Closed
@berickson1

Description

@berickson1

TypeScript Version: 2.7.0-dev.20180110

Code

export class Test {
    private _foo: string;
    constructor() {
        this._init();
    }

    private _init() {
        this._foo = 'test';
    }
}

https://github.com/berickson1/Playground/blob/master/strictPropertyInitError.ts

Expected behavior:
Code compiles with strict flags on

Actual behavior:
strictPropertyInitError.ts(4,13): error TS2564: Property '_foo' has no initializer and is not definitely assigned in the constructor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design LimitationConstraints of the existing architecture prevent this from being fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions