Skip to content

Instantly share code, notes, and snippets.

@yuta0801
Created July 16, 2019 12:35
Show Gist options
  • Save yuta0801/32ed2034030a1aafd17a41208d1a0451 to your computer and use it in GitHub Desktop.
Save yuta0801/32ed2034030a1aafd17a41208d1a0451 to your computer and use it in GitHub Desktop.
const f1 = <T>(val: T) => val
const f2 = <T>(val: T) => () => val
const t1: 'foo' = f1('foo')
// const f1: <"foo">(val: "foo") => "foo"
const t2: 'foo' = f2('foo')()
// const f2: <string>(val: string) => () => string
// Type 'string' is not assignable to type '"foo"'. ts(2322)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment