I had to insert many more exclamation marks for --noUncheckedIndexedAccess.
I wish there's a way to specify "this function returns an array of n items" where n is an argument.
I have this code in the test suite:
asyncfunctionwaitNClients(n:number):Promise<Socket[]>{// wait until n TCP clients are connected, then return them}const[sockA,sockB]=awaitwaitNClients(2);
Previously, this works fine. Now, I need to either put an exclamation mark next to everywhere sockA and sockB is used, or add a as [Socket, Socket]. This gets annoying when the sockets are used in many places, or there are many sockets so that the tuple type gets longer.
I wish I can specify the tuple type like Socket[6], or even better specify the function type like
NDNts updated to TypeScript 4.1 on the day it came out.
ESLint didn't give me any trouble this time.
github.com/yoursunny/NDNts/commit/...
I had to insert many more exclamation marks for
--noUncheckedIndexedAccess
.I wish there's a way to specify "this function returns an array of n items" where n is an argument.
I have this code in the test suite:
Previously, this works fine. Now, I need to either put an exclamation mark next to everywhere
sockA
andsockB
is used, or add aas [Socket, Socket]
. This gets annoying when the sockets are used in many places, or there are many sockets so that the tuple type gets longer.I wish I can specify the tuple type like
Socket[6]
, or even better specify the function type likeIt's not so hard to do this with conditional types now in TypeScript 4.1!