当我试图在React中与TypeScript一起使用ResizeObserver时,我得到了错误:'ResizeObserver' only refers to a type, but is being used as a value here。 我定义了以下接口,因为TypeScript不包含定义: interface ResizeObserver {
observe(target: Element): void;
unobserve(target: Element): void;
disconnect(): void;
} 我在下面的组件中使用它:
以下是我的步骤:
Install node latest v7
Install angular cli > npm install -g @angular/cli
Open CMD and via CMD navigate to Desktop > cd Desktop
Create an angular project via angular CLI > ng new testNg
Navigate to project > cd testing
Run ng serve to launch > ng serve ( response all good, pag
我有一个打字测试:
describe ('User should be able to login', () => {
beforeEach(()=> {
browser.addMockModule('mockLogin', function() {
angular.module('mockLogin', []).value('foo', 'bar');
});
我的modName是一个typescript类:
export class mockLogin {
... some code
}
我想使用
我正在尝试让scullyio在一个真正基础的新版本上工作。开箱即用的骨架。步骤如下:
已安装@angular/cli。
运行新的scully
运行ng build --prod
运行npm运行scully
但是不断地得到:
> scully@0.0.0 scully
> npx scully --
logging with severity "warning"
using plugins from folder "./scully"
Typescript error while compiling plugins. the error is:
er
在Heroku上部署一个普通的应用程序时,我会出错,请在下面找到日志:
Could not find local "typescript" package.The "@ngtools/webpack" package requires a local "typescript@^2.0.2" package to be installed.Error: Cannot find module 'typescript'
Error: Could not find local "typescript" package.Th
我正在尝试使用resizeObserver,但在TS中,我收到以下错误: Argument of type '(element: ResizeObserverEntry) => void' is not assignable to parameter of type 'ResizeObserverCallback'.
Types of parameters 'element' and 'entries' are incompatible.
Type 'ResizeObserverEntry[]'
所以我在我的Angular 10项目中有一个默认的和一个自定义的spec.ts文件,它们都不会被Karma检测到运行。你知道为什么会发生这种事吗? 我的Karma配置文件(实际未更改): // Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: ''
我尝试用角CLI ng build --prod构建项目,并得到了以下错误:
TypeError中的错误:无法读取未定义的属性“类别”
如果我使用非--prod 构建,则不会得到任何错误。
完全错误:
ERROR in TypeError: Cannot read property 'kind' of undefined
at isParameterPropertyDeclaration (node_modules/typescript/lib/typescript.js:13445:88)
at Object.filter (node_modules/
我在angular 4项目中使用ng服务器运行,得到错误。
Cannot read property 'length' of undefined
但是我的项目中没有任何属性长度..
完整的错误
Your global Angular CLI version (1.2.1) is greater than your local
version (1.1.3). The local Angular CLI version is used.
To disable this warning use "ng set --global warnings.versionMi
我是一个全新的角度4,并试图弄清楚一个简单的项目的基本结构。我已经测试了我的项目,昨天它运行得很好。但是今天,当我打开我的项目并想要做"ng serve“时,它显示了下面的错误。不知道问题出在哪里。
TypeError: Cannot read property 'length' of undefined
at createSourceFile (C:\Users\IR\Desktop\angular-first-project\node_modules\typescript\lib\typescript.js:15457:109)
at parseSourceFile
我刚刚更新了我的angular项目。看起来一切都很好,除了我得到了以下警告: npm WARN @angular-devkit/build-angular@0.800.2 requires a peer of typescript@>=3.1 < 3.5 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/compiler-cli@8.0.0 requires a peer of typescript@>=3.4 <3.5 but none is i
我收到以下错误: ERROR in RangeError: Maximum call stack size exceeded
at getResolvedBaseConstraint (/project/node_modules/typescript/lib/typescript.js:53262:43)
at getBaseConstraintOfType (/project/node_modules/typescript/lib/typescript.js:53242:34)
at getTypeFacts (/project/node_modules/types