sindresorhus / ow

Function argument validation for humans
https://sindresorhus.com/ow/
MIT License
3.81k stars 108 forks source link

TypeScript 3 #104

Open sindresorhus opened 6 years ago

sindresorhus commented 6 years ago

It's out: https://blogs.msdn.microsoft.com/typescript/2018/07/30/announcing-typescript-3-0/

We can probably replace this mess https://github.com/sindresorhus/ow/blob/db4af81a7e9de6a1c61d92e02121fb03982fd6e6/source/index.ts#L45-L54 with generic spreading.

@SamVerschueren I tried removing the above code and the test still passes. Are the tests faulty or is that code moot?

Do you think there are any places we should use the unknown keyword?

SamVerschueren commented 6 years ago

There's a catch all any method https://github.com/sindresorhus/ow/blob/db4af81a7e9de6a1c61d92e02121fb03982fd6e6/source/index.ts#L55. This mess is only needed for better type inference because the catch all just returns a generic predicate and not a specific one.

Not sure about the unknown type, I'll need to check the codebase.

sindresorhus commented 5 years ago

We should look into whether we can use any of these new features: https://devblogs.microsoft.com/typescript/announcing-typescript-3-4/