Lots of imports required to type a hash
Closed this issue · 2 comments
sublimator commented
From some code I was working on recently
import { sha512, SHA512 } from '@noble/hashes/sha512'
import { Hash } from '@noble/hashes/utils'
export default class Sha512 {
hash: Hash<SHA512>
In this case could simply do hash = sha512.create()
but
Maybe it's fine, but it seems a bit involved?
Thoughts?
paulmillr commented
I think ReturnType<Type>
should work here and would be less code
sublimator commented
Fair, I was using ReturnType but it felt a bit naff somehow