Bird
0
0

Which of the following is the correct import statement to use DefaultValuePipe in a NestJS controller?

easy📝 Syntax Q3 of 15
NestJS - Pipes
Which of the following is the correct import statement to use DefaultValuePipe in a NestJS controller?
Aimport { DefaultValuePipe } from '@nestjs/common';
Bimport { DefaultValuePipe } from 'nestjs/core';
Cimport DefaultValuePipe from '@nestjs/common';
Dimport { DefaultValuePipe } from 'nestjs/pipes';
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct NestJS package for DefaultValuePipe

    DefaultValuePipe is part of '@nestjs/common' package.
  2. Step 2: Check import syntax

    Correct syntax uses named import with curly braces.
  3. Final Answer:

    import { DefaultValuePipe } from '@nestjs/common'; -> Option A
  4. Quick Check:

    DefaultValuePipe comes from '@nestjs/common' [OK]
Quick Trick: DefaultValuePipe is in '@nestjs/common' package [OK]
Common Mistakes:
  • Using default import instead of named import
  • Importing from wrong NestJS package

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes