This repository has been archived by the owner on Jul 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(template): constrain non-null-parameter with
{}
(#54)
- Loading branch information
Showing
22 changed files
with
28 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import {Property} from './$types'; | ||
|
||
export function $extend<K extends string, V, T>(property: K, value: V, object: T): T & Record<K, V>; | ||
export function $general<T>(property: Property, value: any, object: T): T; | ||
export function $extend<K extends string, V, T extends {}>(property: K, value: V, object: T): T & Record<K, V>; | ||
export function $general<T extends {}>(property: Property, value: any, object: T): T; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import {Path} from './$types'; | ||
|
||
export function $<T>(path: Path, value: any, object: T): T; | ||
export function $<T extends {}>(path: Path, value: any, object: T): T; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import {Omit} from './$operation'; | ||
import {Property} from './$types'; | ||
|
||
export function $keyof<T, K extends keyof T>(property: K, object: T): Omit<T, K>; | ||
export function $keyof<T extends {}, K extends keyof T>(property: K, object: T): Omit<T, K>; | ||
export function $record<T extends Record<K, any>, K extends string>(property: K, object: T): Omit<T, K>; | ||
export function $general<T>(property: Property, object: T): T; | ||
export function $general<T extends {}>(property: Property, object: T): T; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import {DeepPartial} from './$operation'; | ||
import {Path} from './$types'; | ||
|
||
export function $<T>(path: Path, object: T): DeepPartial<T>; | ||
export function $<T extends {}>(path: Path, object: T): DeepPartial<T>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import {Property} from './$types'; | ||
|
||
export function $<T>(property: Property, object: T): boolean; | ||
export function $(property: Property, object: {}): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import {Property} from './$types'; | ||
|
||
export function $<T>(property: Property, object: T): boolean; | ||
export function $(property: Property, object: {}): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {List, Property} from './$types'; | ||
|
||
export function $keyof<T, K extends keyof T>(keys: List<K>, object: T): Pick<T, K>; | ||
export function $keyof<T extends {}, K extends keyof T>(keys: List<K>, object: T): Pick<T, K>; | ||
export function $record<T extends Record<K, any>, K extends string>(keys: List<K>, object: T): Pick<T, K>; | ||
export function $general<T>(keys: List<Property>, object: T): Partial<T>; | ||
export function $general<T extends {}>(keys: List<Property>, object: T): Partial<T>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import {List, Property} from './$types'; | ||
|
||
export function $pick<T, K extends keyof T>(keys: List<K>, object: T): Pick<T, K>; | ||
export function $general<T>(keys: List<Property>, object: T): Partial<T>; | ||
export function $pick<T extends {}, K extends keyof T>(keys: List<K>, object: T): Pick<T, K>; | ||
export function $general<T extends {}>(keys: List<Property>, object: T): Partial<T>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import {Dictionary, KeyedObjectMorphism} from './$types'; | ||
|
||
export function $<T, U extends Dictionary<T>>(fn: KeyedObjectMorphism<T, boolean, keyof U>, object: U): Partial<U>; | ||
export function $<T extends {}, U extends Dictionary<T>>(fn: KeyedObjectMorphism<T, boolean, keyof U>, object: U): Partial<U>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {List, Property} from './$types'; | ||
|
||
export function $keyof<T, K extends keyof T>(key: K, object: T): T[K]; | ||
export function $keyof<T extends {}, K extends keyof T>(key: K, object: T): T[K]; | ||
export function $record<K extends string, T extends Record<K, any>>(key: K, object: T): T[K]; | ||
export function $general(key: Property, object: {}): any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import {Constructor, Property} from './$types'; | ||
|
||
export function $guard<T, U, K extends string>(constructor: Constructor<T>, key: K, object: U): object is U & Record<K, T>; | ||
export function $guard<T, U extends {}, K extends string>(constructor: Constructor<T>, key: K, object: U): object is U & Record<K, T>; | ||
export function $general(constructor: Constructor<any>, key: Property, object: {}): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {List, Property} from './$types'; | ||
|
||
export function $keyof<D, T, K extends keyof T>(defaults: D, key: K, object: T): T[K] | D; | ||
export function $keyof<D, T extends {}, K extends keyof T>(defaults: D, key: K, object: T): T[K] | D; | ||
export function $record<D, K extends string, T extends Record<K, any>>(defaults: D, key: K, object: T): T[K] | D; | ||
export function $general(defaults: any, key: Property, object: {}): any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {Predicate, Property} from './$types'; | ||
|
||
export function $keyof<T, K extends keyof T>(fn: Predicate<T[K]>, key: K, object: T): boolean; | ||
export function $keyof<T extends {}, K extends keyof T>(fn: Predicate<T[K]>, key: K, object: T): boolean; | ||
export function $record<K extends string, T extends Record<K, any>>(fn: Predicate<T[K]>, key: K, object: T): boolean; | ||
export function $general<V>(fn: Predicate<V>, key: Property, object: {}): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {List, Property} from './$types'; | ||
|
||
export function $keyof<T, K extends keyof T>(keys: List<K>, object: T): T[K][]; | ||
export function $keyof<T extends {}, K extends keyof T>(keys: List<K>, object: T): T[K][]; | ||
export function $record<K extends string, T extends Record<K, any>>(keys: List<K>, object: T): T[K][]; | ||
export function $general(keys: Property[], object: {}): any[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export function $<T>(value: T): T[keyof T][]; | ||
export function $<T extends {}>(value: T): T[keyof T][]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export function $<T>(value: T): T[keyof T][]; | ||
export function $<T extends {}>(value: T): T[keyof T][]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`R_propIs(Number)('a') 1`] = `"<U>(object: U) => object is U & Record<\\"a\\", Number>"`; | ||
exports[`R_propIs(Number)('a') 1`] = `"<U extends {}>(object: U) => object is U & Record<\\"a\\", Number>"`; | ||
exports[`R_propIs(Number)('a')(object) 1`] = `"boolean"`; | ||
exports[`R_propIs(Number, 'a') 1`] = `"<U>(object: U) => object is U & Record<\\"a\\", Number>"`; | ||
exports[`R_propIs(Number, 'a') 1`] = `"<U extends {}>(object: U) => object is U & Record<\\"a\\", Number>"`; | ||
exports[`R_propIs(Number, 'a', object) 1`] = `"boolean"`; |