Error in angular-token.model.d.ts
I'm submitting a...
- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [x] Bug report
- [ ] Performance issue
- [ ] Feature request
- [ ] Documentation issue or request
- [ ] Other... Please describe:
Current behavior
When building with strictNullChecks=true, the following error is raised:
ERROR in node_modules/angular-token/lib/angular-token.model.d.ts(11,5): error TS2411: Property 'name' of type 'string | undefined' is not assignable to string index type 'string'.
node_modules/angular-token/lib/angular-token.model.d.ts(12,5): error TS2411: Property 'userType' of type 'string | undefined' is not assignable to string index type 'string'.
Expected behavior
No error.
What is the motivation / use case for changing the behavior?
I would like to be able to use this library with strictNullChecks set to true.
Environment
Angular-Token version: 7.0.1 Angular version: 7 Typescript version: 3.2.4 & 3.4.5
Bundler
- [x] Angular CLI (Webpack)
- [ ] Webpack
- [ ] SystemJS
Browser:
- [x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
Others: N/A
Notes:
The issue is with the RegisterData definition here:
https://github.com/neroniaky/angular-token/blob/master/projects/angular-token/src/lib/angular-token.model.ts#L19
The following proposed change to the index signature should work since the RegisterData definition with the named properties allows an undefined string value for userType and name:
export interface RegisterData {
[key: string]: string | undefined;
}
See the following for a demo of the issue and solution.
Edit: Updated environment version to indicate Typescript version.