Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types file #352

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
declare module 'react-quiz-component' {
import { ReactElement } from 'react';

type QuestionType = "text" | "photo"

type AnswerSelectionType = "single" | "multiple"

type Question = {
question: string
questionType: QuestionType
answers: string[]
correctAnswer: string
answerSelectionType: AnswerSelectionType
messageForCorrectAnswer?: string
messageForIncorrectAnswer?: string
explanation?: string
point?: string
segment?: string
}

type QuizStructure = {
quizTitle: string
questions: Question[]
}

type QuizProps = {
quiz: QuizStructure;
disableSynopsis?: boolean;
shuffleAnswer?: boolean;
shuffle?: boolean;
showDefaultResult?: boolean;
showInstantFeedback?: boolean;
continueTillCorrect?: boolean;
timer?: number;
allowPauseTimer?: boolean
}

const Quiz: (props: QuizProps) => ReactElement;
export default Quiz;
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.9.1",
"description": "React Quiz Component",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.es.js",
"scripts": {
"dev": "webpack-dev-server --mode development",
Expand All @@ -24,7 +25,7 @@
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "^7.23.3",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plug-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-html": "^1.0.3",
"@rollup/plugin-node-resolve": "^15.2.3",
Expand Down