Skip to content
This repository has been archived by the owner on Apr 14, 2020. It is now read-only.

Latest commit

 

History

History
22 lines (15 loc) · 386 Bytes

tBoolean.md

File metadata and controls

22 lines (15 loc) · 386 Bytes

tBoolean

import { typedec, tBoolean } from "typedec";

@typedec()
class TestClass {
    @tBoolean() public foo: boolean;

    constructor(@tBoolean() foo: boolean) {
        this.foo = foo;
    }
}

new TestClass(null); // TypeError: 0 must be an boolean

const t: TestClass = new TestClass(true);

t.foo = 100; // TypeError: foo must be an boolean

t.foo = false;