1.39.0 • Published 2 years ago

@trivia-api/models v1.39.0

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
2 years ago

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",
};
1.39.0

2 years ago

1.36.0

2 years ago

1.34.0

2 years ago

1.29.0

2 years ago

1.28.0

2 years ago

1.32.0

2 years ago

1.33.0

2 years ago

1.30.0

2 years ago

1.25.0

3 years ago

1.26.0

3 years ago

1.27.0

3 years ago

1.19.0

3 years ago

1.18.0

3 years ago

1.21.0

3 years ago

1.20.0

3 years ago

1.17.0

3 years ago

1.9.0

3 years ago

1.5.0

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.5-1

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago