4 ms·
I get the same overall FTA score of 7 for both of your examples. When omitting the return type (which can be inferred), you get the exact same scores. Not just
by uallo 11mo ago
I get the same overall FTA score of 7 for both of your examples. When omitting the return type (which can be inferred), you get the exact same scores. Not just the same FTA score. Also note that `Return<User>` should be just `User` if you prefer to specify the return type explicitly. That change will improve several of the scores as well.
- whilenot-dev 11mo ago> Also note that `Return<User>` should be just `User` if you prefer to specify the return type explicitly. No? first_user = data[0] assigns User | undefined to first_user, since the list isn't guaranteed to be non-empty. I expect Return to be implemented as type Return<T> = T | undefined, so Return<User> makes sense.
- uallo 11mo agoYou are correct if `noUncheckedIndexedAccess` is enabled. It is off by default (which is a pity, really). I assumed `Return<User>` was a mistake, not a custom type as you suggest. But your interpretation seems more likely anyway.
- devjab 11mo agoBoth score 7 now though. This scores 6: function a(b) { return b[0]; } This scores 3: const a = (a) => a;