Currently, I am facing a strange issue in my ASP.NET 5 application where I am using Angular 1.4 with TypeScript and RXJS. Somehow, during the runtime, all my interface properties are getting converted from camel casing to Pascal casing. This unexpected behavior is causing difficulties for me. Can anyone explain why this is happening and suggest how to prevent it?
It's worth mentioning that I am utilizing promises to fetch data from a web API, following a pattern like this:
public GetDataFromAPI(request: Messages.IRequest): Observable<Messages.IResponse> {
let result: IPromise<Messages.IResponse>;
result = this.$http.post("http://api.domain.com/GetData", request).then(
(response: ng.IHttpPromiseCallbackArg<Messages.IResponse>) => {
return response.data;
}
);
return Observable.fromPromise(result).retry(3);
}
Below is an example of how I have declared the interface:
export interface IResponse{
firstName : string;
lastName : string;
age : number
}
Upon receiving the data back, I noticed that its properties are now in Pascal casing instead of CamelCasing, which makes them inaccessible through their original names.
response.data.FirstName
response.data.LastName
response.data.Age