typescript class import csv file code example
Example: typescript class import csv file
import csvData from './latlong.csv';
import textData from '../common/text/info.txt';
import jsonData from '../common/json/jsondata.json';
export const TextResource = textData;
export const JsonResource = <IJsondata> jsonData;
export const CsvResource = <ILatLong[]> csvData;
export interface IJsondata {
email: string;
password: string;
}
export interface ILatLong {
name: string;
lat: any;
long: any;
}
declare module "*.txt" {
const content: string;
export default content;
}
declare module '*.csv' {
const value: any;
export default value;
}