0
0
Typescriptprogramming~10 mins

Triple-slash directives 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 add a triple-slash directive for a type definition file.

Typescript
/// <reference path=[1] />
Drag options to blanks, or click blank then click option'
A"./script.ts"
B'./types.js'
C"./types.d.ts"
D'./module.json'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes instead of double quotes.
Referencing a .js or .ts file instead of a .d.ts file.
Omitting the quotes around the path.
2fill in blank
medium

Complete the triple-slash directive to reference a types package.

Typescript
/// <reference types=[1] />
Drag options to blanks, or click blank then click option'
A'react'
B'express'
C"lodash"
D"node"
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes instead of double quotes.
Referencing a package name that is not installed.
Omitting quotes around the package name.
3fill in blank
hard

Fix the error in the triple-slash directive syntax.

Typescript
/// <reference [1]="./globals.d.ts" />
Drag options to blanks, or click blank then click option'
Apath
Btype
Cpaths
Dtypes
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'paths' instead of 'path'.
Confusing 'type' with 'types'.
Omitting the attribute name.
4fill in blank
hard

Fill both blanks to create a triple-slash directive referencing a types package with the correct syntax.

Typescript
/// <reference [1]=[2] />
Drag options to blanks, or click blank then click option'
Atypes
B"jest"
C"mocha"
Dpath
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'path' instead of 'types' for packages.
Not using quotes around the package name.
Using single quotes instead of double quotes.
5fill in blank
hard

Fill all three blanks to create a triple-slash directive referencing a path to a type definition file with correct syntax.

Typescript
/// <reference [1]=[2][3] />
Drag options to blanks, or click blank then click option'
Apath
B"
C./custom.d.ts
D'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes instead of double quotes.
Omitting quotes around the path.
Using 'types' instead of 'path' for file references.