Skip to content
This repository has been archived by the owner on Dec 10, 2022. It is now read-only.

Commit

Permalink
fix(preset): Add types for public methods
Browse files Browse the repository at this point in the history
To allow TS generate d.ts files
  • Loading branch information
gund committed Dec 30, 2017
1 parent db21e33 commit 38f859b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/preset/preset-default.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';

import { createWithPresetMethodFor } from './preset-method';
import { createWithPresetMethodFor, WithPresetMethod } from './preset-method';
import { PresetService } from './preset.service';

@NgModule({
Expand All @@ -11,5 +11,5 @@ import { PresetService } from './preset.service';
providers: [PresetService],
})
export class PresetDefaultModule {
static withPreset = createWithPresetMethodFor(PresetDefaultModule);
static withPreset: WithPresetMethod = createWithPresetMethodFor(PresetDefaultModule);
}
6 changes: 5 additions & 1 deletion src/preset/preset-method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { ANALYZE_FOR_ENTRY_COMPONENTS, ModuleWithProviders, Type } from '@angula

import { PRESET_TYPES_TOKEN, PresetType } from './preset-token';

export function createWithPresetMethodFor<T = any>(moduleClass: Type<any>) {
export type WithPresetMethod<T = any> = (presetType: PresetType<T>) => ModuleWithProviders;

export function createWithPresetMethodFor<T = any>(
moduleClass: Type<any>
): WithPresetMethod<T> {
return (presetType: PresetType<T>): ModuleWithProviders => {
return {
ngModule: moduleClass,
Expand Down

0 comments on commit 38f859b

Please sign in to comment.