Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to augment the existing module by adding a new function.
Typescript
declare module "myModule" { export function [1](): void; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function name that already exists in the module.
Forgetting to use the 'export' keyword.
✗ Incorrect
The new function added to the module is named 'newFunction'.
2fill in blank
mediumComplete the code to augment the module by adding a new interface.
Typescript
declare module "myModule" { export interface [1] { id: number; } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing an unrelated interface name.
Not using PascalCase for interface names.
✗ Incorrect
The interface 'User' is added to the module to represent a user object.
3fill in blank
hardFix the error in the module augmentation syntax by completing the code.
Typescript
declare module "myModule" [1] { export const version: string; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'extends' or 'augment' keywords which are invalid here.
Missing the opening curly brace.
✗ Incorrect
The module block must start with a curly brace '{' after the module name.
4fill in blank
hardComplete the code to correctly augment the module by adding a new type alias.
Typescript
declare module "myModule" { {
export type {BLANK_2}} = string | number;
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect block delimiters.
Choosing a type alias name that is not descriptive.
✗ Incorrect
The module block opens with '{' and the new type alias is named 'AliasType'.
5fill in blank
hardFill both blanks to augment the module by adding a new namespace with a function.
Typescript
declare module "myModule" { export namespace [1] { export function [2](): void; } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Missing the opening brace for the module block.
Using invalid or unrelated names for namespace or function.
✗ Incorrect
The module block opens with '{', the namespace is 'Utils', and the function is 'logMessage'.