- npm install && npm start
- Edit
src/types.ts
to add a new property inIObj
like this and save:
export type IObj = {
name: string;
age: number;
newProp?: number;
};
There should not be any error in terminal after saving.
- Edit
src/index.ts
to add the new property inobj
like this and save:
import { IObj } from './type';
let obj: IObj = {
age: 13,
name: '123',
newProp: 1,
};
const _name = obj.name;
There should not be any error in terminal after saving.
- Edit
src/index.tsx
to use the new property like this and save:
import { IObj } from './type';
let obj: IObj = {
age: 13,
name: '123',
newProp: 1,
};
const _name = obj.name;
const _newProp = obj.newProp;
It throws the error:
Failed to compile.
[eslint]
src/index.tsx
Line 10:7: Unsafe assignment of an `any` value @typescript-eslint/no-unsafe-assignment
Search for the keywords to learn more about each error.
ERROR in [eslint]
src/index.tsx
Line 10:7: Unsafe assignment of an `any` value @typescript-eslint/no-unsafe-assignment
Search for the keywords to learn more about each error.
webpack compiled with 1 error
No issues found.
You need to save to re-compile after each step, otherwise it may not reproduce.