I am so confused about the type, it should be "string" but it says it can't be any

public getHashCode(): number {
const { X, Y, Z } = this.position;
const positionString: string = `${X}${Y}${Z}`;

if (typeIs(positionString, "string")) {
return Crc32(positionString);
}
return 0;
}
public getHashCode(): number {
const { X, Y, Z } = this.position;
const positionString: string = `${X}${Y}${Z}`;

if (typeIs(positionString, "string")) {
return Crc32(positionString);
}
return 0;
}
the Crc32 is from @rblxts/crypto
9 Replies
Nightmare
NightmareOP2w ago
Using values of type `any` is not supported! Use `unknown` instead.eslintroblox-ts/no-any
(alias) Crc32(Data: string): number
import Crc32
Using values of type `any` is not supported! Use `unknown` instead.eslintroblox-ts/no-any
(alias) Crc32(Data: string): number
import Crc32
like there is no way that it gets any other type of data than string kinda fixed by using diffrent algorithm but i still wonder why is that error there
Tester
Tester2w ago
what is it for?
Nightmare
NightmareOP2w ago
Just created hash of position
Tester
Tester2w ago
why? like do you store something?
Nightmare
NightmareOP2w ago
well I discovered i don't need it but i still wonder where the error is
Tester
Tester2w ago
have you tried to avoid typechecking this "typeIs" or restarting visual studio code?
Nightmare
NightmareOP2w ago
nope
Tester
Tester2w ago
can you? or you already deleted?
Nightmare
NightmareOP2w ago
already deleted lol

Did you find this page helpful?