本文整理汇总了TypeScript中@angular/compiler/src/output/output_ast.importExpr函数的典型用法代码示例。如果您正苦于以下问题:TypeScript importExpr函数的具体用法?TypeScript importExpr怎么用?TypeScript importExpr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了importExpr函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should create a reexport', () => {
expect(emitStmt(someVar.set(o.importExpr(externalModuleIdentifier))
.toDeclStmt(null, [o.StmtModifier.Exported])))
.toEqual([
`export {someExternalId as someVar} from 'somePackage/someOtherPath';`, ``
].join('\n'));
});
开发者ID:smart-web-rock,项目名称:angular,代码行数:7,代码来源:ts_emitter_spec.ts
示例2: it
it('should create multiple reexports from the same file', () => {
const someVar2 = o.variable('someVar2');
const externalModuleIdentifier2: CompileIdentifierMetadata = {
reference: new StaticSymbol(anotherModuleUrl, 'someExternalId2', [])
};
expect(emitStmt(
[
someVar.set(o.importExpr(externalModuleIdentifier)).toDeclStmt(),
someVar2.set(o.importExpr(externalModuleIdentifier2)).toDeclStmt()
],
['someVar', 'someVar2']))
.toEqual([
`export {someExternalId as someVar,someExternalId2 as someVar2} from 'somePackage/someOtherPath';`,
``
].join('\n'));
});
开发者ID:manekinekko,项目名称:angular,代码行数:16,代码来源:ts_emitter_spec.ts
示例3: it
it('should create no reexport if the variable is typed', () => {
expect(emitStmt(someVar.set(o.importExpr(externalModuleIdentifier))
.toDeclStmt(o.DYNAMIC_TYPE, [o.StmtModifier.Exported])))
.toEqual([
`import * as i0 from 'somePackage/someOtherPath';`,
`export var someVar:any = i0.someExternalId;`
].join('\n'));
});
开发者ID:DanielKucal,项目名称:angular,代码行数:8,代码来源:ts_emitter_spec.ts
示例4: it
it('should insert imports after existing imports', () => {
context = context.override({
somePackage: {
'someGenFile.ts': `
import {Component} from '@angular/core';
@Component({selector: 'some-class', template: 'hello!'})
export class SomeClass {}
export class SomeOtherClass {}
`
}
});
host = new MockCompilerHost(context);
expect(emitStaticMethod(new o.ReturnStatement(
o.importExpr(new o.ExternalReference('@angular/core', 'Component')))))
.toContain('const core_1 = require("@angular/core"); const i0 = require("@angular/core");');
});
开发者ID:Cammisuli,项目名称:angular,代码行数:19,代码来源:r3_transform_spec.ts
示例5:
[o.literalArr([...externalIds1, ...externalIds].map(id => o.importExpr(id))).toStmt()],
开发者ID:AnthonyPAlicea,项目名称:angular,代码行数:1,代码来源:output_jit_spec.ts
注:本文中的@angular/compiler/src/output/output_ast.importExpr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论