@coderbyheart on Twitter

A static archive of Markus Tacker's tweets. Follow me on Mastodon: @[email protected].

Home / Archive / 2018 / 2018-08 / 1026208537180090369
Replying to @wolframkriesing

@wolframkriesing
@typescriptlang You can write a type which
defines your "interface".

TS will then complain if your implementation does not match this type.

Sun, 05 Aug 2018 20:49:15 UTC♥ 2

1 reply

Replying to @coderbyheart

@wolframkriesing
@typescriptlang Example:
https://www.typescriptlang.org/play/index.html#src=type%20f%20%3D%20(x%3A%20string)%20%3D%3E%20boolean%0D%0A%0D%0Aconst%20myf%3Af%20%3D%20function%20myf%20(x%3A%20string)%20%7B%0D%0A%20%20%20%20return%200%3B%20%2F%2F%20invalid%0D%0A%7D

Sun, 05 Aug 2018 20:53:34 UTC♥ 1