Last active
July 13, 2019 13:56
-
-
Save sitepodmatt/b42e6ba1aa74d10794a534f1970cc1a7 to your computer and use it in GitHub Desktop.
babysteps.js
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
class DType<A> { | |
readonly _A!: { [P in keyof A] : A[P] } | |
constructor(t : A) { | |
} | |
} | |
const UserModel = new DType({ name: ""}) | |
type Infer<C extends any> = C['_A'] | |
type User = Infer<typeof UserModel> | |
function sayHello(s : User) { | |
console.log(s.name) | |
} | |
sayHello({ xname: "Matt" }) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment