As explained, explicit type annotation ties the type of variable to the annotation, i.e. helloStr can now only be a string, instead of the narrower literal type "hello" and if you wanted to use it in a place that requires the type "hello" (not string), you would need to narrow it down to hello (by checking if it's hello before passing it along).
In contrast, when using satisfies, you get the same type-safety that helloStr can only be a string, but the inferred narrower type of hello is retained, hence we are just checking to make sure that our variable type fits a certain type (in this case can only a string) without changing its narrower or more precise inferred type. For const helloStr, the type hello is more precise and much a better type than string.
This is because you should always prefer the narrower variable type whenever possible (link).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
As explained, explicit type annotation ties the type of variable to the annotation, i.e.
helloStrcan now only be astring, instead of the narrower literal type "hello" and if you wanted to use it in a place that requires the type "hello" (notstring), you would need to narrow it down tohello(by checking if it's hello before passing it along).In contrast, when using
satisfies, you get the same type-safety thathelloStrcan only be a string, but the inferred narrower type ofhellois retained, hence we are just checking to make sure that our variable type fits a certain type (in this case can only a string) without changing its narrower or more precise inferred type. For consthelloStr, the typehellois more precise and much a better type than string.This is because you should always prefer the narrower variable type whenever possible (link).