Skip to content

component helper doesn't prohibit passing unknown args #213

Open
@boris-petrov

Description

@boris-petrov

foo-components.ts:

import templateOnlyComponent from '@glint/environment-ember-loose/ember-component/template-only';

interface IFoo {
  readonly Args: {
    readonly name: string;
    readonly model: number;
  };
}

const Foo = templateOnlyComponent<IFoo>();

export default Foo;

declare module '@glint/environment-ember-loose/registry' {
  export default interface Registry {
    'foo-component': typeof Foo;
  }
}

qux.ts:

import Component from '@glint/environment-ember-loose/glimmer-component';

export interface IQux {
  readonly Args: {
    readonly [key: string]: any;
  };
}

export default class Qux extends Component<IQux> {
}

declare module '@glint/environment-ember-loose/registry' {
  export default interface Registry {
    Qux: typeof Qux;
  }
}

bar.hbs:

<Qux @foo={{component "foo-component" name1="asd" model="asd"}} />
<Qux @foo={{component "foo-component" name="asd" model1="asd"}} />
<Qux @foo={{component "foo-component" name1="asd" model1="asd"}} />

Only the first and the third lines give an error. The second one also should but doesn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    typescript limitationSomething we can't do in the system as it stands

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions