0
0
Typescriptprogramming~10 mins

Module augmentation syntax in Typescript - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
AnewFunction
BoldFunction
CmainFunction
DstartFunction
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function name that already exists in the module.
Forgetting to use the 'export' keyword.
2fill in blank
medium

Complete 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'
AUser
BProduct
COrder
DItem
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing an unrelated interface name.
Not using PascalCase for interface names.
3fill in blank
hard

Fix 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'
Aextends
B{
Caugment
Ddeclare
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'extends' or 'augment' keywords which are invalid here.
Missing the opening curly brace.
4fill in blank
hard

Complete 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'
A{
BAliasType
CAugmentType
D}
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect block delimiters.
Choosing a type alias name that is not descriptive.
5fill in blank
hard

Fill 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'
A{
BUtils
ClogMessage
DHelpers
Attempts:
3 left
💡 Hint
Common Mistakes
Missing the opening brace for the module block.
Using invalid or unrelated names for namespace or function.