I have declared my data structures and trying to get the data from the backend. The data which were coming from backend were JSON object and it is not implicitly converting the data from string to any other type which I was defined.
For Ex :
export interface Model {
data1 : EnumType,
data2 : date
}
export enum EnumType{
Up,
Down,
Left,
Right,
}
export class Data{
public getData() {
const url: string = '/data';
let resultData : Model[] = this.http.get<Model[]>(url);
console.log('result Data...' , resultData)
}
}
We are getting Data from backend like this : data1 : "UP" , data2 : '2012-01-26T13:51:50.417-07:00'
**Output:**
result Data... data1 : "UP" , data2 : '2012-01-26T13:51:50.417-07:00'
**Expected Output:**
result Data... data1 : 1(enum type) , data2 : 2012-01-26T13:51:50.417-07:00(Date format)
(OR) it should throw error since the data we are sending doesnt match.
Why it is not implicitly converting if we are using "noImplicitAny" in tsConfig.json whether it will convert implicitly?