React のコーディングで Tagged Template Literals は、よく使われる様になりました。styled-components にはじまり、GraphQLや lit-html などのライブラリでも使われ、お馴染みになったこの構文。さて、この Tagged Template Literals を利用した便利な関数ですが、型推論がどの様に行われているのか、気になりませんか? プレースホルダー関数型推論 例えば次の様な styled-components は、Function Component に適用されたProps型を、プレースホルダー関数で引数型を勝手に推論してくれます。 type Props = { hoge: string } const Component: React.FC<Props> = props => ( <div>hello world</div> )