Javascript 如何返回不带类型的数组

Javascript 如何返回不带类型的数组,javascript,angular,typescript,angular6,Javascript,Angular,Typescript,Angular6,我有单元测试,我想返回如下值: (13) [{…}] 0: id: 154 portfolioCompanyId: 916 url: "https://sharepoint.warburgpincus.com/docs/enterprise/Historical Valuations Documents/Mercator" dealCode: null modifiedOn: "2018-09-21T14:55:49.173" modifiedBy: "setup" createdOn: "20

我有单元测试,我想返回如下值:

(13) [{…}]
0:
id: 154
portfolioCompanyId: 916
url: "https://sharepoint.warburgpincus.com/docs/enterprise/Historical Valuations Documents/Mercator"
dealCode: null
modifiedOn: "2018-09-21T14:55:49.173"
modifiedBy: "setup"
createdOn: "2018-09-21T14:55:49.173"
createdBy: "setup"
linkId: 1
link:
id: 1
name: "Historical Reports"
我编写了如下返回值的代码:

[PortfolioCompanyLink]
0: PortfolioCompanyLink
url: "http://google.com"
link: Link
name: "test"
我已经写了下面的代码

fixture = TestBed.createComponent(PortfolioCompanyLinkDropdownComponent);
        component = fixture.componentInstance;
        component.portfolioCompany = new PortfolioCompany();
        component.portfolioCompany.name = "Test Company";
        let testLinks = new Array<PortfolioCompanyLink>();
        let testFirstLink = new PortfolioCompanyLink();
        testFirstLink.url = "http://google.com";
        //testFirstLink.linkName="test";
        testFirstLink.link = new Link();
        testFirstLink.link.name = "test";
        testLinks.push(testFirstLink);
        component.portfolioCompany.portfolioCompanyLink = testLinks;

        fixture.detectChanges();

如果要创建不带类型的数组,可以使用
array.from()

例如:


console.log(数组的类型.from([1,2,3])我不想编辑主代码。我想编辑测试代码
console.info(this.portfolioCompany.portfolioCompanyLink)
    .filter(link => link.link.name.toLowerCase()); // it throws an error
let arrayWithoutType =  Array.from(console.info(this.portfolioCompany.portfolioCompanyLink)
                                      .filter(link => link.link.name.toLowerCase()));