Hello World
Challenge
Hello, World!
In Type Challenges, we use the type system itself to do the assertion.
For this challenge, you will need to change the following code to make the tests pass (no type check errors).
// expected to be string
type HelloWorld = any;
// you should make this work
type test = Expect<Equal<HelloWorld, string>>;
Click the Take the Challenge button to start coding! Happy Hacking!
Solution
JavaScript hat drei häufig verwendete Primitive: string, number und boolean. Für jedes gibt es einen entsprechenden Typ in TypeScript.
Die Lösung besteht darin, den Typ von any in string zu ändern.
type HelloWorld = string;