📜  typescript 类导入 csv 文件 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:35.741000             🧑  作者: Mango

代码示例1
// # csv file
import csvData from './latlong.csv';
//# text import
import textData from '../common/text/info.txt';
//# json import
import jsonData from '../common/json/jsondata.json';


export const TextResource = textData; // not-work
export const JsonResource =  jsonData; // work
export const CsvResource =  csvData; // not-work

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;
}