![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
typescript
Ocean_HL
这个作者很懒,什么都没留下…
展开
-
tsconfig.json——某库的声明文件没找到——Cannot find type definition file for ‘babel__generator‘
解决方法一:手动指定编译器选项的 typeRoots 属性:{ "compilerOptions": { typeRoots: ["node_modules/@types"] }}解决方法二:开启编译器选项的 skipLibCheck 属性{ "compilerOptions": { "skipLibCheck": true }}原创 2021-10-20 11:20:22 · 9182 阅读 · 0 评论 -
tsconfig---开启importHelpers配置后报错:找不到tslib
开启importHelpers配置后报错:找不到tslib开启 importHelpers配置后,找不到 tslib原因分析解决方法开启 importHelpers配置后,找不到 tslib原因分析我的 tsconfig.json 配置信息是如下:{ "compilerOptions": { "target": "es5", "module": "amd", # 错误的地方 "outDir": "./lib", "rootDir": "./src",原创 2021-10-17 23:17:12 · 4574 阅读 · 0 评论 -
如何在typescript-react项目中使用emotion的css行内样式
css 行内样式支持选择符,伪类等高级操作第一步:在组件顶部导入 @emotion/react 下的所有运行时。/** @jsxImportSource @emotion/react */第二步:使用 css 属性/** @jsxImportSource @emotion/react */import React from 'react';const App:React.FC = () => { return <div css={{ backgroundColor:原创 2021-09-07 11:13:27 · 716 阅读 · 0 评论 -
React 的TS环境下使用 http-proxy-middleware配置代理
1. 安装 http-proxy-middlewareyarn add http-proxy-middleware -D2. 在 src 目录下创建 setupProxy.js 文件必须是 js 文件,不能是 ts 文件,否则不生效。src/setupProxy.jsconst { createProxyMiddleware } = require('http-proxy-middleware');module.exports = function (app) { app.use(原创 2021-08-24 17:24:44 · 2188 阅读 · 1 评论 -
react-ts中配置 css 模块类名的智能提示
1. 安装插件 typescript-plugin-css-modulesyarn add typescript-plugin-css-modules -D2. 配置tsconfig.json文件{ "compilerOptions": { "plugins": [{ "name": "typescript-plugin-css-modules", "options": { "customMatcher": "\\.(c|le||lle|sa|sc原创 2021-08-10 15:41:02 · 1483 阅读 · 0 评论 -
nodemon的强大,不止可以运行.js文件还可以运行.ts文件
全局安装ts-node 和 nodemonnpm i -g nodemon ts-node# or yarnyarn global add nodemon ts-nodenodemon运行.ts文件直接运行想要执行的命令,nodemon 会直接识别文件的后缀名,不止可以运行.ts 文件,还可以执行 .py 等文件。nodemon index.ts...原创 2021-07-08 20:02:04 · 1192 阅读 · 0 评论 -
Problems loading reference ‘https://json.schemastore.org/tsconfig‘
问题:Problems loading reference ‘https://json.schemastore.org/tsconfig’: Unable to load schema from ‘https://json.schemastore.org/tsconfig’: Request vscode/content failed原因:vscode在加载tsconfig.json文件时会向https://json.schemastore.org/tsconfig发送请求,由于本机的同源策略安全设置原创 2021-03-15 21:24:00 · 12689 阅读 · 7 评论 -
无法写入文件webpack.config.js,因为它会覆盖输入文件
问题在tsconfig.json中设置对js文件进行编译的配置项时,会报出无法写入webpack.config.js中原因因为在webpack.config.js中已经设置了ts-loader加载器,用于处理ts文件,所以tsconfig.json的配置项与webpack.config.js中的配置项产生了冲突。解决方法统一在webpack.config.js中处理ts文件和js文件不要在tsconfig.json中设置有关js的配置项。...原创 2021-03-14 09:53:32 · 3161 阅读 · 0 评论 -
在配置文件tsconfig.json中找不到任何输入。指定的 “include“ 路径为“[“**/*“]”,“exclude“ 路径为“[]”
问题在VSCode编辑器中,莫名奇妙的就报出在tsconfig.json中找不到任何输入。按照vscode的报错提示,在tsconfig.json中添加"include":[“src/**/*”]和"exclude": [],依旧报错。原因创建tsconfig.json配置文件时,vscode会自动检测当前项目当中是否有ts文件,若没有则报错,提示用户需要创建一个ts文件后,再去使用typescript。解决方法在项目中创建一个.ts文件,vscode便不会再报此错误。提示优原创 2021-03-14 09:36:57 · 18041 阅读 · 4 评论