
typeScript
hainandetong
编程,菜是原罪
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
ts构造一个类型,将T的所有属性设置为可选Partial
使用 Partialinterface Todo { title: string; description: string;}function updateTodo(todo: Todo, fieldsToUpdate: Partial<Todo>) { return { ...todo, ...fieldsToUpdate };}const todo1 = { title: "organize desk", description: "clear clutte原创 2020-05-31 15:17:28 · 4767 阅读 · 0 评论 -
ts拆分类型为多个类型的组合
可使用继承接口的方式也可以使用&拼接的作用type A1={name:'sansan'}&{age:number}let b:A1={name:'sansan',age:22}原创 2020-05-30 14:52:09 · 2548 阅读 · 0 评论 -
ts设置类型为字符串中的其中一种
type Aie='danger'|'primary'let a:Aie='danger'如果a的值不是Aie中的其中一种,则会报错原创 2020-05-30 14:28:15 · 2994 阅读 · 0 评论 -
ts定义方法的类型
源码常用这种形式,多数会加泛型type aatype={(even:string):string};interface aaie{ (even:string):string}let aa:aaie=(str)=>{ console.log(str) return str;}aa('gg')原创 2020-02-28 10:26:55 · 3914 阅读 · 0 评论 -
Could not find a declaration file for module ‘***‘ 的ts问题
例子import VueAppend from ‘vue-append’Vue.use(VueAppend)添加一个xxx.d.ts文件内容declare module 'vue-append'{ import { PluginFunction} from 'vue' class VueAppend { static install: PluginFuncti...原创 2020-01-14 18:04:42 · 3014 阅读 · 0 评论 -
组件里引用typeScript时,this报红
"noImplicitThis": false原创 2019-12-30 15:12:50 · 654 阅读 · 0 评论 -
typeScript element与vant冲突
tsconfig.json设置 "compilerOptions": { "skipLibCheck":true } 忽略所有的声明文件( *.d.ts)的类型检查原创 2019-12-26 10:23:44 · 619 阅读 · 0 评论 -
typeScript @types/webpack-env/index.d.ts报错
tsconfig.json设置 "compilerOptions": { "skipLibCheck":true } 忽略所有的声明文件( *.d.ts)的类型检查原创 2019-12-26 10:06:57 · 3100 阅读 · 0 评论 -
vue安装typeScript
npm install -D typescript ts-loader// webpack.config.jsmodule.exports = { resolve: { // 将 `.ts` 添加为一个可解析的扩展名。 extensions: ['.ts', '.js'] }, module: { rules: [ // ... 忽略其它规则...原创 2019-11-09 20:58:46 · 581 阅读 · 0 评论