Within the cso-api.ts
file, I have a class definition for CsoAPI:
export default class CsoAPI extends RESTDataSource {
constructor() {
...
}
async getNamePopularityDataByYear(year:number): Promise<NamePopularityData> {
...
Even though this function is specified to return a type of
Promise<NamePopularityData>
, why am I not receiving any warnings or errors when I import it into another file and assign it to a string?
import CsoAPI from '../apis/cso-api';
...
const nameData:string = await CsoAPI.getNamePopularityDataByYear(year)
Furthermore, when hovering over the imported function in VSCode, the incorrect type is displayed: https://i.sstatic.net/TJs23.png