seb-oss / ng-wizard

Wizard component built for angular 12+
https://sebgroup.github.io/ng-wizard/
Apache License 2.0
2 stars 8 forks source link

wizard-texts.ts is incorrectly typed #113

Open kvaren opened 2 years ago

kvaren commented 2 years ago

Issue:

After installing and implementing the wizard I kept getting this error (and similar for each property in the model):

Error: node_modules/@sebgroup/ng-wizard/lib/models/wizard-texts.d.ts:2:5 - error TS2411: Property 'wiz_next_action' of type 'string | undefined' is not assignable to string index type 'string'.

2     wiz_next_action?: string;
      ~~~~~~~~~~~~~~~

The package itself has the strict property set to false in tsconfig, which is the reason why the package itself won't complain about this error. But as soon as the main project has strict set to true the error pasted above will appear.

Proposed solution:

Fix wizard-texts.ts model by correctly setting the types:

export interface WizardTexts {
    wiz_next_action?: string;
    wiz_prev_action?: string;
    wiz_close_action?: string;
    wiz_save_action?: string;
    wiz_header_title?: string;
    wiz_step_description?: string;
    [key: string]: string | undefined;
}

and set strict to true in tsconfig, since this is the default behavior of Angular projects.

If this is not fixed every project that wants to use the wizard won't be able to have strict typing enabled.

hjalmers commented 2 years ago

Thanks for reporting @kvaren, would mind making a pull request by any chance?