我的应用程序中出现以下错误(npm 5.4.2,反应15.4,typescript 2.5.3,webpack 2.2.1,webpack-dev-server 2.4.1).
这将有效:
<div style={{position: 'absolute'}}>working</div>
Run Code Online (Sandbox Code Playgroud)
这不会编译:
const mystyle = {
position: 'absolute'
}
<div style={mystyle}>not working</div>
Run Code Online (Sandbox Code Playgroud)
编译错误是:
ERROR in ./src/components/Resource.tsx
(61,18): error TS2322: Type '{ style: { position: string; }; children: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.
Type '{ style: { position: string; }; children: string; }' is not assignable to type 'HTMLAttributes<HTMLDivElement>'.
Types of property 'style' are incompatible.
Type '{ position: string; }' is not assignable to type 'CSSProperties'.
Types of property …Run Code Online (Sandbox Code Playgroud) 我收到以下警告,因为我在我的应用程序中使用了 moment.js(npm 5.4.2,react 15.4,typescript 2.5.3,webpack 2.2.1,webpack-dev-server 2.4.1)。
在 ./src/utils/commons.ts 我使用 momentjs 并且它工作正常,但我收到警告。
任何帮助表示赞赏。
WARNING in ./~/moment/src/lib/locale/locales.js
Module not found: Error: Can't resolve './locale' in 'C:\myproject\node_modules\moment\src\lib\locale'
@ ./~/moment/src/lib/locale/locales.js 65:16-60
@ ./~/moment/src/lib/locale/locale.js
@ ./~/moment/src/moment.js
@ ./src/utils/commons.ts
@ ./src/components/Login.tsx
@ ./src/app.tsx
@ ./src/index.tsx
@ multi (webpack)-dev-server/client?http://localhost:3000 webpack/hot/dev-server react-hot-loader/patch webpack-dev-server/client?http://localhost:3000 webpack/hot/only-dev-server ./src/index.tsx
webpack: Compiled with warnings.
Run Code Online (Sandbox Code Playgroud) EhCache文档说:
如果实现并注册CacheEventListener以接收元素已过期,则可以看到在尝试获取过期元素时触发事件,但不会在'timeToIdleSeconds'之后触发.
是否有可能在过期后强制删除过期的元素?因为在我的情况下,在此之后没有人会试图再次获得它.
谢谢.