Make Props default to never in 'moonjs'. (#27667)

* Make `Props` default to `never` in 'moonjs'.

* Update test for missing props.
This commit is contained in:
Daniel Rosenwasser
2018-07-30 11:00:29 -07:00
committed by Sheetal Nandi
parent 0e67e6c782
commit aa115293b8
2 changed files with 3 additions and 2 deletions

View File

@@ -22,11 +22,11 @@ declare namespace Moon {
}
interface MoonConstructor {
new <Props extends string, Data, Methods>(options?: ConstructorOptions<Props, Data, Methods>): Instance<Data & Methods & Record<Props, any>>;
new <Props extends string = never, Data = {}, Methods = {}>(options?: ConstructorOptions<Props, Data, Methods>): Instance<Data & Methods & Record<Props, any>>;
}
interface MoonStatic extends MoonConstructor {
component<Props extends string, Data, Methods>(name: string, options: ComponentOptions<Props, Data, Methods>): MoonConstructor;
component<Props extends string = never, Data = {}, Methods = {}>(name: string, options: ComponentOptions<Props, Data, Methods>): MoonConstructor;
config: MoonConfig;
use(plugin: object): void;
compile(template: string): void;

View File

@@ -17,6 +17,7 @@ const count = app.get("count");
count; // $ExpectType number
app.get("increment")(); // $ExpectType void
app.callMethod("increment"); // $ExpectType any
app.get("blahblahblah"); // $ExpectError
app.destroy();