Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@trivia-api/models

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trivia-api/models

Models for The Trivia API.

  • 1.39.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Trivia API Models

Typescript models and guards for types used in 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";

// The Typescript compiler will complain because there is no `incorrectAnswers` property
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",
};

// The compiler will be happy because this is a valid instance of Question - all required properties are present.
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",
};

Keywords

FAQs

Package last updated on 06 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc