Trivia API Models
Functions to fetch data from The Trivia API.
Usage
Install the models with npm install @trivia-api/models
, and use within Typescript files:
import { type Question } from "@trivia-api/models";
const invalidQuestion: Question = {
question: "What is the capital of France?",
correctAnswer: "Paris",
category: "Geography",
tags: ["france", "capital_cities", "europe"],
type: "Multiple Choice",
difficulty: "easy",
id: "abcde-fg",
};
const validQuestion: Question = {
question: "What is the capital of France?",
correctAnswer: "Paris",
incorrectAnswers: ["Lyon", "Marseilles", "Bordeaux"],
category: "Geography",
tags: ["france", "capital_cities", "europe"],
type: "Multiple Choice",
difficulty: "easy",
id: "abcde-fg",
};