Skip to content

Decorator and DecoratorBlock typings are out of sync with documentation #1572

@Mindar

Description

@Mindar

Note by @nknapp: Unless anybody objects, this change will be made in the 4.x branch by December, 8 2019

Currently the typings and documentation for Decorator and DecoratorBlock are out of sync.

According to the documentation Decorator and DecoratorBlock should extend Statement. In the typings they extend MustacheStatement and BlockStatement. This makes it impossible to add the correct type fields for them (see #1570 and #1571 for more info ).

I assume this was done to write less code in the typings, but I think it's incorrect. I'd love to create a pull request that fixes this by making sure they extend Statement (just like they should according to the documentation) and then adding the missing fields if that's ok?

Basically I'd like to turn this

// types/index.d.ts
interface Decorator extends MustacheStatement { }

interface DecoratorBlock extends BlockStatement { }

into this

// types/index.d.ts
interface Decorator extends Statement {
    type: "Decorator";

    path: PathExpression | Literal;
    params: Expression[];
    hash: Hash;

    strip: StripFlags | null;
}

interface DecoratorBlock extends Statement {
    type: "DecoratorBlock";
    path: PathExpression | Literal;
    params: Expression[];
    hash: Hash;

    program: Program | null;

    openStrip: StripFlags | null;
    closeStrip: StripFlags | null;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    possibly breakingAdd a comment to this issue, if you think this will break your build

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions