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
NightmareOP6d 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
Tester6d ago
what is it for?
Nightmare
NightmareOP6d ago
Just created hash of position
Tester
Tester6d ago
why? like do you store something?
Nightmare
NightmareOP6d ago
well I discovered i don't need it but i still wonder where the error is
Tester
Tester6d ago
have you tried to avoid typechecking this "typeIs" or restarting visual studio code?
Nightmare
NightmareOP6d ago
nope
Tester
Tester6d ago
can you? or you already deleted?
Nightmare
NightmareOP6d ago
already deleted lol

Did you find this page helpful?