我假设@angular/core
的所有主要版本都适用于此。我应该将包对等依赖项指定为:
"peerDependencies": {
"@angular/core": "x.x"
}
我正在为NPM上发布的角度服务创建一个包。该模块只包含一组缓动函数,可以使用任何版本的角度。以下简要摘要以供参考。如您所见,服务从Injectable
导入@angular/core
。我假设它对主要版本5,6,7等有效。
import {Injectable} from '@angular/core';
@Injectable()
export class RoundProgressEase {
// t: current time (or position) of the neonate. This can be seconds or frames, steps,
// seconds, ms, whatever – as long as the unit is the same as is used for the total time.
// b: beginning value of the property.
// c: change between the beginning and destination value of the property.
// d: total time of the neonate.
linearEase(t: number, b: number, c: number, d: number): number {
return c * t / d + b;
};
easeInQuad(t: number, b: number, c: number, d: number): number {
return c * (t /= d) * t + b;
};
}
答案 0 :(得分:2)
如果您想要一个开放式范围,请使用星号(*)
"peerDependencies": {
"@angular/core": "*"
}