A few findings from experimenting with isolated declarations:
Exported variables will need an explicit type annotation (✅ implemented).
export const c1: 1 = 1; // ✔ ok, is explicit
type SchemaEntry<A, B extends keyof A> = | |
| Validator<A[B]> | |
| ((obj: Id<A>) => Validator<A[B]>); | |
type Schema<A extends object> = { [k in keyof A]: SchemaEntry<A, k> }; | |
class Result<T> {} |
enum Option { Some = 1, Empty = 2 } | |
type DistributeOptionValue<T> = T extends null | undefined ? OptionValue<T, Option.Empty> : OptionValue<T, Option.Some>; | |
interface OptionValue<T, O extends Option> { | |
option: O; | |
value: T; | |
} | |
function getValue<T>(value: T): DistributeOptionValue<T> | |
function getValue<T>(value: T): OptionValue<T, Option> { | |
return ({ |
[ | |
{ | |
"license": "ABC123", | |
"type": "drone", | |
"model": "Amazon 1250", | |
"airTimeHours": "6050", | |
"base": "New York", | |
"latLong": "40.775596 -73.97461" | |
}, | |
{ |
[ | |
{ | |
"license": "ABC123", | |
"type": "drone", | |
"model": "Amazon 1250", | |
"airTimeHours": "6050", | |
"base": "New York", | |
"latLong": "40.775596 -73.97461" | |
}, | |
{ |
[ | |
{ | |
"productId": 1, | |
"productName": "Leaf Rake", | |
"productCode": "GDN-0011", | |
"releaseDate": "March 19, 2019", | |
"description": "Leaf rake with 48-inch wooden handle.", | |
"price": 19.95, | |
"starRating": 3.2, | |
"imageUrl": "assets/images/leaf_rake.png" |