refactor(ivy): ngcc - fake core and tslib should be typings files (#25445)

Previously these fake files were full TypeScript source
files (`.ts`) but this is not necessary as we only need the
typings not the implementation.

PR Close #25445
This commit is contained in:
Pete Bacon Darwin
2019-04-28 20:48:34 +01:00
committed by Jason Aden
parent 48b77459ef
commit 0fa72a8bc8
5 changed files with 28 additions and 41 deletions

View File

@ -64,49 +64,38 @@ export function makeTestProgram(
// TODO: unify this with the //packages/compiler-cli/test/ngtsc/fake_core package
export function getFakeCore() {
return {
name: 'node_modules/@angular/core/index.ts',
name: 'node_modules/@angular/core/index.d.ts',
contents: `
type FnWithArg<T> = (arg?: any) => T;
function callableClassDecorator(): FnWithArg<(clazz: any) => any> {
return null !;
export declare const Component: FnWithArg<(clazz: any) => any>;
export declare const Directive: FnWithArg<(clazz: any) => any>;
export declare const Injectable: FnWithArg<(clazz: any) => any>;
export declare const NgModule: FnWithArg<(clazz: any) => any>;
export declare const Input: any;
export declare const Inject: FnWithArg<(a: any, b: any, c: any) => void>;
export declare const Self: FnWithArg<(a: any, b: any, c: any) => void>;
export declare const SkipSelf: FnWithArg<(a: any, b: any, c: any) => void>;
export declare const Optional: FnWithArg<(a: any, b: any, c: any) => void>;
export declare class InjectionToken {
constructor(name: string);
}
function callableParamDecorator(): FnWithArg<(a: any, b: any, c: any) => void> {
return null !;
}
function makePropDecorator(): any {
}
export const Component = callableClassDecorator();
export const Directive = callableClassDecorator();
export const Injectable = callableClassDecorator();
export const NgModule = callableClassDecorator();
export const Input = makePropDecorator();
export const Inject = callableParamDecorator();
export const Self = callableParamDecorator();
export const SkipSelf = callableParamDecorator();
export const Optional = callableParamDecorator();
export class InjectionToken {
constructor(name: string) {}
}
export interface ModuleWithProviders<T = any> {}
export declare interface ModuleWithProviders<T = any> {}
`
};
}
export function getFakeTslib() {
return {
name: 'node_modules/tslib/index.ts',
name: 'node_modules/tslib/index.d.ts',
contents: `
export function __decorate(decorators: any[], target: any, key?: string | symbol, desc?: any) {}
export function __param(paramIndex: number, decorator: any) {}
export function __metadata(metadataKey: any, metadataValue: any) {}
export declare function __decorate(decorators: any[], target: any, key?: string | symbol, desc?: any);
export declare function __param(paramIndex: number, decorator: any);
export declare function __metadata(metadataKey: any, metadataValue: any);
`
};
}