#"object is used before assigned" but i did assign it in a function

4 messages · Page 1 of 1 (latest)

rare apexBOT
#

@dreamy rampart Here's a shortened URL of your playground link! You can remove the full link from your message.

potsu#5101

Preview:```ts
let State: string

SetState("sleep")

CheckIfThisStateIsAValidState(State)

function SetState(ToSet: string) {
State = ToSet
}

function CheckIfThisStateIsAValidState(
State: string
) {}```

abstract tendon
#

ts can't know that.

#

you could use ! to tell ts that it is, but that's not great for something like this

#

SetState is really impure there.