Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable 'name' is of the wrong type #81

Open
pascallaprade opened this issue Aug 15, 2017 · 0 comments
Open

Variable 'name' is of the wrong type #81

pascallaprade opened this issue Aug 15, 2017 · 0 comments

Comments

@pascallaprade
Copy link

In the breadcrumbService.ts file, in the getFriendlyNameForRoute method, variable name is created as a string but not assigned. At the end of the method, it is checked against a falsy value.

However, since its type is only string, TypeScript does not allow for it to be undefined in strict mode.

Even if this compiles correctly in normal modes, it does not when in strict mode, and should be fixed.

A simple fix considering the actual usage would just be to make the type string | undefined and everything would work as is.

Here is the actual tsc error message:

node_modules/ng2-breadcrumb/app/components/breadcrumbService.ts(83,16): error TS2454: Variable 'name' is used before being assigned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant