小编Sta*_*sov的帖子

是否可以在茉莉花测试中获取模板引用变量?

例如在 my-components-list.html 我有:

<my-component #first></my-component>
<my-component #second></my-component>
<my-component #third></my-component>
<input #forth/>
Run Code Online (Sandbox Code Playgroud)

我想在我的测试中得到它,例如:

it('test', () => {
    const myComponent: HTMLElement = fixture.debugElement.query(By.someMethod('#first'));
    const myInput: HTMLElement = fixture.debugElement.query(By.someMethod('#forth'));
}
Run Code Online (Sandbox Code Playgroud)

jasmine angular

5
推荐指数
1
解决办法
1157
查看次数

TypeScript 通用剩余参数到联合返回类型

目前,TypeScript 允许声明动态泛型参数。

function bind<U extends any[]>(...args: U);
Run Code Online (Sandbox Code Playgroud)

但是如果我希望我的函数返回参数类型的并集怎么办?就像是:

function bind<U extends any[]>(...args: U): U1 | U2 | U3...;
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点?

typescript

2
推荐指数
1
解决办法
1155
查看次数

标签 统计

angular ×1

jasmine ×1

typescript ×1