一些问题
import morgan from 'morgan'
Could not find a declaration file for module 'morgan'. 'D:/React/antd-demo-ts/node_modules/_morgan@1.10.0@morgan/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/morgan` if it exists or add a new declaration (.d.ts) file containing `declare module 'morgan';`
declare module 'morgan';
Test
let num : number = 2
let str : string = '卡尔'
let bool : boolean = true
export const test: string[] = ['可领取', '已领取', '未领取']
const dataMethod = (a : number, b : string): number => {
return 2
}
function fn1(a : string, b : string): number {
return 4
}
interface SignProps {
status?: number,
signState?: Array<object>,
signUpdateMethod?: () => void
}
const SignPage: React.FC<SignProps> = ({
status,
signState,
signUpdateMethod
}) => {
...
}
泛型指在定义函数、接口或类的时候,不预先指定具体的类型,而在使用的时候再指定类型的一种特性。
未完待续...