Bird
0
0

Which of the following is the correct way to define a string property named title in a NestJS schema?

easy📝 Syntax Q12 of 15
NestJS - Database with Prisma
Which of the following is the correct way to define a string property named title in a NestJS schema?
A@Prop() title: number;
B@Prop() title: string;
C@Prop() title = 123;
D@Prop() title: boolean;
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct type for a string property

    The property title should be of type string to hold text data.
  2. Step 2: Check the syntax of @Prop()

    The correct syntax is @Prop() title: string; which declares a string property.
  3. Final Answer:

    @Prop() title: string; -> Option B
  4. Quick Check:

    String property uses type string [OK]
Quick Trick: Use @Prop() with correct TypeScript type for properties [OK]
Common Mistakes:
  • Using wrong types like number or boolean for string data
  • Assigning values instead of declaring types
  • Missing @Prop() decorator

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes