

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Function Type Syntax
incomplete
2: Inferred Return Types
incomplete
3: Void
incomplete
4: Function Types
incomplete
5: Type Alias
incomplete
6: Importing Types
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
So you know how we discussed that:
const myPowerLevel = 9000;
Is better TypeScript than:
const myPowerLevel: number = 9000;
What follows is a bit of personal opinion, but I think the same is generally true for function return (not parameter) types.
Instead of this:
function divide(a: number, b: number): number {
return a / b;
}
We can write this:
function divide(a: number, b: number) {
return a / b;
}
And TypeScript infers the output type as number.
Click to play video
Support.ai needs a way to combine our internal system prompt with a user's prompt.
Complete the combinePrompts function, it should:
systemPrompt and userPrompt.\n. The system prompt should come first, followed by the user prompt.The return type should be inferred as a string. Not explicitly specified.