随笔分类 - 报错整理
摘要:https://stackoverflow.com/questions/64732623/react-typescript-cannot-find-module-or-its-corresponding-type-declaration css.d.ts declare module '*.scss
阅读全文
摘要:react-router-dom 默认版本问题, 改用hashrouter解决 import { HashRouter, Route, Switch, Redirect, Link } from 'react-router-dom' <HashRouter> <Switch> <Route path
阅读全文
Error: Unexpected character '�' (Note that you need plugins to import files that are not JavaScript)
摘要:https://www.cnblogs.com/xulei1992/p/15176992.html https://segmentfault.com/a/1190000038956767 tsdx.config.js const postcss = require('rollup-plugin-po
阅读全文
摘要:// tsdx.config.js const images = require('@rollup/plugin-image'); module.exports = { rollup(config, options) { config.plugins = [ images({ include: ['
阅读全文
摘要:检查package.json或者npm link时是否正确,更改后删掉node_modules重新安装
阅读全文
摘要:此语法需要名为 "__spreadArray" 的导入帮助器 安装最新版tslib即可
阅读全文
摘要:如前文所示,在对应的index.d.ts/index.d.tsx中添加如下代码: interface Function { _toFixed(params: any): void; } Function.prototype._toFixed = function(params: any) { thi
阅读全文
摘要:类型“typeof BigNumber”的参数不能赋给类型“Value”的参数。 类型“typeof BigNumber”缺少类型“Instance”中的以下属性: c, e, s 原来: bigNumber._toFixed = function (...arg: any) { return ne
阅读全文
摘要:Your rootDir is currently set to "./". Please change your rootDir to "./src".TSDX has deprecated setting tsconfig.compilerOptions.rootDir to "./" as i
阅读全文
摘要:创建对应文件:如index.d.ts或者index.d.tsx。然后声明一下即可。 如果您不关心外部库的类型,并且希望将所有没有类型的库导入为any,则可以将其添加到具有.d.ts扩展名的文件中: declare module '*'; 这样做的好处(和缺点)是,您可以导入任何东西,TS可以编译。
阅读全文
摘要:删除package-lock.json后重新安装即可
阅读全文
摘要:Error: Invalid hook call. Hooks can only be called inside of the body of a function component. 场景:sdk中使用antd,export之后前端工程引入报错 原因:react冲突 解决: "peerDepe
阅读全文
摘要:react 报错:'React' must be in scope when using JSX react/react-in-jsx-scope 解决: import React, {Component} from 'react'; R大写
阅读全文
摘要:ERROR TypeError: fs.readdir is not a function lerna项目packages下,使用create-react-app创建的项目调用使用create-react-library创建的组件方法时报错 解决:未解决,删除create-react-app项目,重
阅读全文
摘要:Failed to load config "react-app" to extend from. 解决: yarn add eslint-config-react-app 或者: yarn add eslint@latest
阅读全文