CLASSROOMIO-T-198: Exercises for Typescript

Co-authored-by: Tunji Adeyemi <[email protected]>


Merge-request: CLASSROOMIO-MR-94
Merged-by: Best Admin <[email protected]>
This commit is contained in:
tunny17
2023-10-09 16:21:26 +00:00
committed by Space Cloud
parent e47d3d38eb
commit aa3c613363
18 changed files with 3395 additions and 1 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ import { CSS_IDS, CSS_TEMPLATES } from './css';
import { calculateTotalPoints, shuffleOptions } from './utils';
import type { ExerciseTemplate } from '$lib/utils/types';
import { JS_IDS, JS_TEMPLATES } from './js';
import { TS_IDS, TS_TEMPLATES } from './typescript';
export const TAGS = {
HTML: 'HTML',
@@ -43,7 +44,7 @@ export const TEMPLATES = {
[TAGS.HTML]: generateTemplateForTag(HTML_IDS, HTML_TEMPLATES),
[TAGS.CSS]: generateTemplateForTag(CSS_IDS, CSS_TEMPLATES),
[TAGS.JS]: generateTemplateForTag(JS_IDS, JS_TEMPLATES),
[TAGS.Typescript]: [],
[TAGS.Typescript]: generateTemplateForTag(TS_IDS, TS_TEMPLATES),
[TAGS.ReactJS]: [],
[TAGS.VueJS]: []
};
@@ -0,0 +1,228 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Simple Types Quiz',
description: 'Test your knowledge of TypeScript simple types.',
questionnaire: {
questions: [
{
title: 'What is the TypeScript type for representing a string?',
name: 'q1',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'str',
is_correct: false
},
{
label: 'string',
is_correct: true
},
{
label: 'text',
is_correct: false
}
]
},
{
title: 'Which keyword is used to declare a constant in TypeScript?',
name: 'q2',
points: 1,
order: 2,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'let',
is_correct: false
},
{
label: 'const',
is_correct: true
},
{
label: 'var',
is_correct: false
}
]
},
{
title: 'What is the TypeScript type for representing a boolean value?',
name: 'q3',
points: 1,
order: 3,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'bool',
is_correct: false
},
{
label: 'boolean',
is_correct: true
},
{
label: 'truefalse',
is_correct: false
}
]
},
{
title: 'Which TypeScript type can hold multiple values, such as a list of numbers?',
name: 'q4',
points: 1,
order: 4,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'array',
is_correct: false
},
{
label: 'number[]',
is_correct: true
},
{
label: 'list',
is_correct: false
}
]
},
{
title: 'What is the TypeScript type for representing a function?',
name: 'q5',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'function',
is_correct: false
},
{
label: 'func',
is_correct: false
},
{
label: '() => void',
is_correct: true
}
]
},
{
title: 'Which TypeScript type represents a value that can be either a number or a string?',
name: 'q6',
points: 1,
order: 6,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'number|string',
is_correct: true
},
{
label: 'mixed',
is_correct: false
},
{
label: 'any',
is_correct: false
}
]
},
{
title: 'In TypeScript, how do you declare a variable without specifying its type?',
name: 'q7',
points: 1,
order: 7,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Using the `var` keyword',
is_correct: false
},
{
label: 'Using the `let` keyword',
is_correct: false
},
{
label: 'Using the `const` keyword',
is_correct: false
},
{
label: 'Using the `any` keyword',
is_correct: true
}
]
},
{
title: 'Which TypeScript type represents a value that can be null or undefined?',
name: 'q8',
points: 1,
order: 8,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'null',
is_correct: false
},
{
label: 'undefined',
is_correct: false
},
{
label: 'null|undefined',
is_correct: true
}
]
},
{
title: 'What is the TypeScript type for representing an object with specific properties?',
name: 'q9',
points: 1,
order: 9,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'object',
is_correct: false
},
{
label: 'Record<string, any>',
is_correct: false
},
{
label: 'Custom interface/type',
is_correct: true
}
]
},
{
title: 'Which TypeScript type can be used to represent a value that is not available yet or an error?',
name: 'q10',
points: 1,
order: 10,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'unknown',
is_correct: true
},
{
label: 'undefined',
is_correct: false
},
{
label: 'null',
is_correct: false
}
]
}
]
}
};
export default template;
@@ -0,0 +1,304 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Special Types Quiz',
description: 'Test your knowledge of TypeScript special types.',
questionnaire: {
questions: [
{
title: 'What is the special type for defining a variable that may have a null value?',
name: 'q1',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Nullable',
is_correct: false
},
{
label: 'Optional',
is_correct: false
},
{
label: 'null',
is_correct: false
},
{
label: 'undefined',
is_correct: false
},
{
label: 'nullish',
is_correct: true
}
]
},
{
title: 'Which special type represents a collection of unique values?',
name: 'q2',
points: 1,
order: 2,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'UniqueSet',
is_correct: false
},
{
label: 'UniqueArray',
is_correct: false
},
{
label: 'Tuple',
is_correct: false
},
{
label: 'Enum',
is_correct: true
},
{
label: 'Record',
is_correct: false
}
]
},
{
title: 'What special type is used to represent a function that never returns?',
name: 'q3',
points: 1,
order: 3,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Void',
is_correct: false
},
{
label: 'Never',
is_correct: true
},
{
label: 'None',
is_correct: false
},
{
label: 'Undefined',
is_correct: false
},
{
label: 'Null',
is_correct: false
}
]
},
{
title: 'Which special type is used for specifying that a variable can be of multiple types?',
name: 'q4',
points: 1,
order: 4,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Any',
is_correct: false
},
{
label: 'Union',
is_correct: true
},
{
label: 'Intersection',
is_correct: false
},
{
label: 'Variant',
is_correct: false
},
{
label: 'Multiple',
is_correct: false
}
]
},
{
title: 'Which special type represents a property of an object?',
name: 'q5',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Member',
is_correct: false
},
{
label: 'Property',
is_correct: false
},
{
label: 'Field',
is_correct: true
},
{
label: 'Attribute',
is_correct: false
},
{
label: 'Variable',
is_correct: false
}
]
},
{
title: 'Which special type is used for defining the shape of an object?',
name: 'q6',
points: 1,
order: 6,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'ObjectType',
is_correct: false
},
{
label: 'ShapeType',
is_correct: false
},
{
label: 'Interface',
is_correct: true
},
{
label: 'ObjectShape',
is_correct: false
},
{
label: 'Struct',
is_correct: false
}
]
},
{
title: 'Which special type is used for defining a key-value pair object?',
name: 'q7',
points: 1,
order: 7,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Record',
is_correct: true
},
{
label: 'Map',
is_correct: false
},
{
label: 'Dictionary',
is_correct: false
},
{
label: 'KeyValuePair',
is_correct: false
},
{
label: 'Object',
is_correct: false
}
]
},
{
title: 'Which special type is used for defining a variable with a default value?',
name: 'q8',
points: 1,
order: 8,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'DefaultValue',
is_correct: false
},
{
label: 'Default',
is_correct: false
},
{
label: 'InitialValue',
is_correct: false
},
{
label: 'Value',
is_correct: false
},
{
label: 'DefaultType',
is_correct: true
}
]
},
{
title: 'What is the special type used for representing a value that may be either a specified type or null or undefined?',
name: 'q9',
points: 1,
order: 9,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'NullableType',
is_correct: false
},
{
label: 'OptionalType',
is_correct: false
},
{
label: 'MixedType',
is_correct: false
},
{
label: 'UnknownType',
is_correct: false
},
{
label: 'NullableTypeUnion',
is_correct: true
}
]
},
{
title: 'What special type represents a value that is the result of a computation that may fail?',
name: 'q10',
points: 1,
order: 10,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Result',
is_correct: true
},
{
label: 'Outcome',
is_correct: false
},
{
label: 'Error',
is_correct: false
},
{
label: 'Fail',
is_correct: false
},
{
label: 'Unsafe',
is_correct: false
}
]
}
]
}
};
export default template;
+304
View File
@@ -0,0 +1,304 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Arrays Quiz',
description: 'Test your knowledge of TypeScript arrays.',
questionnaire: {
questions: [
{
title: 'What is the correct way to declare an array in TypeScript?',
name: 'q1',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'let array = []',
is_correct: false
},
{
label: 'const array = {}',
is_correct: false
},
{
label: 'const array: Array<number> = []',
is_correct: true
},
{
label: 'const array: number[] = {}',
is_correct: false
},
{
label: 'let array = new Array<number>()',
is_correct: false
}
]
},
{
title: 'What method is used to add new elements to the end of an array in TypeScript?',
name: 'q2',
points: 1,
order: 2,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'push()',
is_correct: true
},
{
label: 'add()',
is_correct: false
},
{
label: 'append()',
is_correct: false
},
{
label: 'insert()',
is_correct: false
},
{
label: 'concat()',
is_correct: false
}
]
},
{
title: 'How do you access the first element of an array in TypeScript?',
name: 'q3',
points: 1,
order: 3,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'array[0]',
is_correct: true
},
{
label: 'array.first()',
is_correct: false
},
{
label: 'array.first',
is_correct: false
},
{
label: 'array.getElement(0)',
is_correct: false
},
{
label: 'array.front()',
is_correct: false
}
]
},
{
title: 'What TypeScript method is used to remove the last element from an array and return that element?',
name: 'q4',
points: 1,
order: 4,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'shift()',
is_correct: false
},
{
label: 'pop()',
is_correct: true
},
{
label: 'removeLast()',
is_correct: false
},
{
label: 'slice()',
is_correct: false
},
{
label: 'splice()',
is_correct: false
}
]
},
{
title: 'What is the result of the following code?\n\n```typescript\nconst numbers = [1, 2, 3, 4, 5];\nconst slicedNumbers = numbers.slice(1, 3);\nconsole.log(slicedNumbers);\n```',
name: 'q5',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: '[1, 2, 3]',
is_correct: false
},
{
label: '[2, 3]',
is_correct: true
},
{
label: '[3, 4]',
is_correct: false
},
{
label: '[2, 4]',
is_correct: false
},
{
label: '[1, 3]',
is_correct: false
}
]
},
{
title: 'In TypeScript, how can you check if an element exists in an array?',
name: 'q6',
points: 1,
order: 6,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Use the `elementOf` operator',
is_correct: false
},
{
label: 'Use the `contains` method',
is_correct: false
},
{
label: 'Use the `includes` method',
is_correct: true
},
{
label: 'Use the `has` method',
is_correct: false
},
{
label: 'Use the `find` method',
is_correct: false
}
]
},
{
title: 'Which TypeScript method is used to join all elements of an array into a string?',
name: 'q7',
points: 1,
order: 7,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'join()',
is_correct: true
},
{
label: 'concat()',
is_correct: false
},
{
label: 'merge()',
is_correct: false
},
{
label: 'combine()',
is_correct: false
},
{
label: 'implode()',
is_correct: false
}
]
},
{
title: 'What is the correct way to remove an element by index from an array in TypeScript?',
name: 'q8',
points: 1,
order: 8,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Use the `remove` method',
is_correct: false
},
{
label: 'Use the `splice` method',
is_correct: true
},
{
label: 'Use the `delete` operator',
is_correct: false
},
{
label: 'Use the `filter` method',
is_correct: false
},
{
label: 'Use the `discard` method',
is_correct: false
}
]
},
{
title: 'What is the correct TypeScript syntax to sort an array in descending order?',
name: 'q9',
points: 1,
order: 9,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'array.sort()',
is_correct: false
},
{
label: 'array.sort((a, b) => b - a)',
is_correct: true
},
{
label: 'array.reverse()',
is_correct: false
},
{
label: 'array.sort((a, b) => a - b)',
is_correct: false
},
{
label: 'array.descending()',
is_correct: false
}
]
},
{
title: 'Which TypeScript method is used to add one or more elements to the beginning of an array?',
name: 'q10',
points: 1,
order: 10,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'prepend()',
is_correct: false
},
{
label: 'unshift()',
is_correct: true
},
{
label: 'push()',
is_correct: false
},
{
label: 'addFirst()',
is_correct: false
},
{
label: 'insertAtStart()',
is_correct: false
}
]
}
]
}
};
export default template;
+264
View File
@@ -0,0 +1,264 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Tuples Quiz',
description: 'Test your knowledge of TypeScript tuples.',
questionnaire: {
questions: [
{
title: 'What is a TypeScript tuple?',
name: 'q1',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'A data structure that stores a fixed-size collection of elements of mixed types.',
is_correct: true
},
{
label: 'A data structure that stores an unlimited number of elements of the same type.',
is_correct: false
},
{
label: 'A data structure that stores elements of the same type and size.',
is_correct: false
},
{
label: 'A data structure that stores elements of mixed types without size restrictions.',
is_correct: false
}
]
},
{
title: 'How do you define a tuple type in TypeScript?',
name: 'q2',
points: 1,
order: 2,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Using the `Tuple` keyword',
is_correct: false
},
{
label: 'Using the `tuple` keyword',
is_correct: true
},
{
label: 'Using the `array` keyword',
is_correct: false
},
{
label: 'Using the `list` keyword',
is_correct: false
}
]
},
{
title: 'How can you access elements of a TypeScript tuple?',
name: 'q3',
points: 1,
order: 3,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'By using the dot notation (e.g., `tuple.0`)',
is_correct: false
},
{
label: 'By using square brackets (e.g., `tuple[0]`)',
is_correct: true
},
{
label: 'By using parentheses (e.g., `tuple(0)`)',
is_correct: false
},
{
label: 'By using the `get` method (e.g., `tuple.get(0)`)',
is_correct: false
}
]
},
{
title: 'Which of the following statements is true about TypeScript tuples?',
name: 'q4',
points: 1,
order: 4,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Tuples allow elements to be added or removed dynamically.',
is_correct: false
},
{
label: 'Tuples can contain elements of different types but must be of fixed size.',
is_correct: true
},
{
label: 'Tuples are resizable arrays with dynamic types.',
is_correct: false
},
{
label: 'Tuples can only contain elements of the same type.',
is_correct: false
}
]
},
{
title: 'What is the correct way to initialize a TypeScript tuple?',
name: 'q5',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'const myTuple: tuple = [1, "two", 3]',
is_correct: false
},
{
label: 'const myTuple: [number, string, number] = [1, "two", 3]',
is_correct: true
},
{
label: 'const myTuple: (number, string, number) = [1, "two", 3]',
is_correct: false
},
{
label: 'const myTuple: tuple<number, string, number> = [1, "two", 3]',
is_correct: false
}
]
},
{
title: 'In a TypeScript tuple, what does the number in the tuple type represent?',
name: 'q6',
points: 1,
order: 6,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'The maximum number of elements that the tuple can hold.',
is_correct: true
},
{
label: 'The index of the first element in the tuple.',
is_correct: false
},
{
label: 'The type of the elements in the tuple.',
is_correct: false
},
{
label: 'The size of the tuple in memory.',
is_correct: false
}
]
},
{
title: 'How do you update a value in a TypeScript tuple?',
name: 'q7',
points: 1,
order: 7,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'You cannot update values in a tuple; tuples are immutable.',
is_correct: true
},
{
label: 'By using the `update` method on the tuple.',
is_correct: false
},
{
label: 'By directly assigning a new value to the tuple element.',
is_correct: false
},
{
label: 'By using the `set` method on the tuple.',
is_correct: false
}
]
},
{
title: 'What is the advantage of using TypeScript tuples over arrays?',
name: 'q8',
points: 1,
order: 8,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Tuples have a dynamic size, making them more flexible.',
is_correct: false
},
{
label: 'Tuples allow you to store elements of different types.',
is_correct: true
},
{
label: 'Tuples have better performance for iteration.',
is_correct: false
},
{
label: 'Tuples provide built-in sorting methods.',
is_correct: false
}
]
},
{
title: 'Can TypeScript tuples be used to represent key-value pairs?',
name: 'q9',
points: 1,
order: 9,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Yes, by using the `key` and `value` properties of a tuple element.',
is_correct: false
},
{
label: 'Yes, by using tuples with two elements where the first element is the key and the second element is the value.',
is_correct: true
},
{
label: 'No, tuples are not suitable for representing key-value pairs.',
is_correct: false
},
{
label: 'No, TypeScript does not support key-value pairs in tuples.',
is_correct: false
}
]
},
{
title: 'Which TypeScript version introduced tuple types?',
name: 'q10',
points: 1,
order: 10,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'TypeScript has always had tuple types.',
is_correct: false
},
{
label: 'TypeScript 2.0',
is_correct: true
},
{
label: 'TypeScript 3.0',
is_correct: false
},
{
label: 'TypeScript 4.0',
is_correct: false
}
]
}
]
}
};
export default template;
@@ -0,0 +1,264 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Object Types Quiz',
description: 'Test your knowledge of TypeScript object types.',
questionnaire: {
questions: [
{
title: 'What is an object type in TypeScript?',
name: 'q1',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'A type that represents a single value, such as a number or string.',
is_correct: false
},
{
label: 'A type that represents a collection of key-value pairs.',
is_correct: true
},
{
label: 'A type that represents an array of values.',
is_correct: false
},
{
label: 'A type that represents a function.',
is_correct: false
}
]
},
{
title: 'How do you define an object type in TypeScript?',
name: 'q2',
points: 1,
order: 2,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Using the `object` keyword.',
is_correct: false
},
{
label: 'Using the `type` keyword with key-value pairs.',
is_correct: true
},
{
label: 'Using the `class` keyword.',
is_correct: false
},
{
label: 'Using the `interface` keyword.',
is_correct: false
}
]
},
{
title: 'What does the following TypeScript object type definition represent?\n\n```\ntype Person = {\n name: string;\n age: number;\n};\n```',
name: 'q3',
points: 1,
order: 3,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'A function type that takes a name and age as arguments and returns a string.',
is_correct: false
},
{
label: 'An object type with properties `name` and `age`, where `name` is a string and `age` is a number.',
is_correct: true
},
{
label: 'A class definition for creating `Person` instances.',
is_correct: false
},
{
label: 'An array type that contains `Person` objects.',
is_correct: false
}
]
},
{
title: 'What is the purpose of using optional properties in TypeScript object types?',
name: 'q4',
points: 1,
order: 4,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'To indicate that a property is required and must have a value.',
is_correct: false
},
{
label: 'To indicate that a property is optional and may have a value or be undefined.',
is_correct: true
},
{
label: 'To indicate that a property should not be accessed.',
is_correct: false
},
{
label: 'To indicate that a property is a function.',
is_correct: false
}
]
},
{
title: 'What is the correct way to access properties of an object type in TypeScript?',
name: 'q5',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'By using the `.` (dot) notation (e.g., `person.name`).',
is_correct: true
},
{
label: 'By using square brackets (e.g., `person["name"]`).',
is_correct: false
},
{
label: 'By using the `get` method (e.g., `person.get("name")`).',
is_correct: false
},
{
label: 'By using parentheses (e.g., `person("name")`).',
is_correct: false
}
]
},
{
title: 'What is an index signature in TypeScript object types?',
name: 'q6',
points: 1,
order: 6,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'A type that defines the index of an array.',
is_correct: false
},
{
label: 'A type that specifies the data type of the keys and the corresponding value data types in an object.',
is_correct: true
},
{
label: 'A type that represents the number of properties in an object.',
is_correct: false
},
{
label: 'A type that represents the order of properties in an object.',
is_correct: false
}
]
},
{
title: 'Can object types in TypeScript have methods?',
name: 'q7',
points: 1,
order: 7,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Yes, object types can have methods defined within them.',
is_correct: true
},
{
label: 'No, object types can only have properties but not methods.',
is_correct: false
},
{
label: 'Methods in TypeScript are defined separately from object types.',
is_correct: false
},
{
label: 'Methods can only be defined in classes, not object types.',
is_correct: false
}
]
},
{
title: 'What is the key difference between an interface and a type alias for defining object types in TypeScript?',
name: 'q8',
points: 1,
order: 8,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Interfaces are more flexible and allow for dynamic typing, while type aliases are more rigid.',
is_correct: false
},
{
label: 'Interfaces can be extended and implemented, while type aliases cannot.',
is_correct: true
},
{
label: 'Type aliases are more powerful and can define complex types, while interfaces are limited.',
is_correct: false
},
{
label: 'There is no difference between interfaces and type aliases for defining object types.',
is_correct: false
}
]
},
{
title: 'Which keyword is used to define an optional property in TypeScript object types?',
name: 'q9',
points: 1,
order: 9,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'The `optional` keyword.',
is_correct: false
},
{
label: 'The `maybe` keyword.',
is_correct: false
},
{
label: 'The `undefined` keyword.',
is_correct: false
},
{
label: 'The `?` (question mark) symbol.',
is_correct: true
}
]
},
{
title: 'What is object destructuring in TypeScript?',
name: 'q10',
points: 1,
order: 10,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'A process of destroying objects to free up memory.',
is_correct: false
},
{
label: 'A way to create new objects from existing objects.',
is_correct: false
},
{
label: 'A technique for extracting properties from objects and assigning them to variables.',
is_correct: true
},
{
label: 'A method for combining multiple objects into one.',
is_correct: false
}
]
}
]
}
};
export default template;
+264
View File
@@ -0,0 +1,264 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Enums Quiz',
description: 'Test your knowledge of TypeScript enums.',
questionnaire: {
questions: [
{
title: 'What is an enum in TypeScript?',
name: 'q1',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'A keyword used to declare variables in TypeScript.',
is_correct: false
},
{
label: 'A way to define a collection of related named constant values.',
is_correct: true
},
{
label: 'A type of function in TypeScript.',
is_correct: false
},
{
label: 'A type of loop in TypeScript.',
is_correct: false
}
]
},
{
title: 'Which keyword is used to define an enum in TypeScript?',
name: 'q2',
points: 1,
order: 2,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'enum',
is_correct: true
},
{
label: 'class',
is_correct: false
},
{
label: 'interface',
is_correct: false
},
{
label: 'type',
is_correct: false
}
]
},
{
title: 'What is the default value of the first enum member if not explicitly assigned?',
name: 'q3',
points: 1,
order: 3,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: '0',
is_correct: true
},
{
label: '1',
is_correct: false
},
{
label: 'undefined',
is_correct: false
},
{
label: 'null',
is_correct: false
}
]
},
{
title: 'How do you access enum members in TypeScript?',
name: 'q4',
points: 1,
order: 4,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'By using dot notation (e.g., `EnumName.MemberName`).',
is_correct: true
},
{
label: 'By using square brackets (e.g., `EnumName["MemberName"]`).',
is_correct: false
},
{
label: 'By using parentheses (e.g., `EnumName("MemberName")`).',
is_correct: false
},
{
label: 'By using the `get` method (e.g., `EnumName.get("MemberName")`).',
is_correct: false
}
]
},
{
title: 'In TypeScript, can enums have string values as members?',
name: 'q5',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Yes, enums can only have string values as members.',
is_correct: false
},
{
label: 'Yes, enums can have both numeric and string values as members.',
is_correct: true
},
{
label: 'No, enums can only have numeric values as members.',
is_correct: false
},
{
label: 'No, enums cannot have values assigned to their members.',
is_correct: false
}
]
},
{
title: 'What is the purpose of using enums in TypeScript?',
name: 'q6',
points: 1,
order: 6,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'To define classes in TypeScript.',
is_correct: false
},
{
label: 'To define named constants representing a set of related values.',
is_correct: true
},
{
label: 'To define functions in TypeScript.',
is_correct: false
},
{
label: 'To define interfaces in TypeScript.',
is_correct: false
}
]
},
{
title: 'What is the benefit of using enums over plain objects in TypeScript?',
name: 'q7',
points: 1,
order: 7,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Enums provide better performance and memory management.',
is_correct: false
},
{
label: 'Enums are easier to use when working with a fixed set of values.',
is_correct: true
},
{
label: 'Enums are not recommended over plain objects in TypeScript.',
is_correct: false
},
{
label: 'Enums can be used to create instances of objects.',
is_correct: false
}
]
},
{
title: 'Can enum members have the same name within the same enum?',
name: 'q8',
points: 1,
order: 8,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Yes, enum members can have the same name within the same enum.',
is_correct: false
},
{
label: 'No, enum members must have unique names within the same enum.',
is_correct: true
},
{
label: 'Enum members are not allowed in TypeScript.',
is_correct: false
},
{
label: 'The naming of enum members does not matter.',
is_correct: false
}
]
},
{
title: 'In TypeScript, can you assign a value to an enum member that is not part of the enum?',
name: 'q9',
points: 1,
order: 9,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Yes, you can assign any value to an enum member in TypeScript.',
is_correct: true
},
{
label: 'No, enum members must have values that are part of the enum.',
is_correct: false
},
{
label: 'Enum members do not have values in TypeScript.',
is_correct: false
},
{
label: 'The assignment of enum values is determined by the compiler.',
is_correct: false
}
]
},
{
title: 'What is the benefit of using numeric values for enum members?',
name: 'q10',
points: 1,
order: 10,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Numeric values allow for better type checking and inference in TypeScript.',
is_correct: true
},
{
label: 'Numeric values make enums harder to use and understand.',
is_correct: false
},
{
label: 'Numeric values are not recommended for enum members.',
is_correct: false
},
{
label: 'Numeric values are required for all enum members in TypeScript.',
is_correct: false
}
]
}
]
}
};
export default template;
@@ -0,0 +1,264 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Aliases and Interfaces Quiz',
description: 'Test your knowledge of TypeScript aliases and interfaces.',
questionnaire: {
questions: [
{
title: 'What is an interface in TypeScript?',
name: 'q1',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'A way to create custom data types.',
is_correct: false
},
{
label: 'A way to implement classes in TypeScript.',
is_correct: false
},
{
label: 'A way to define the structure of an object.',
is_correct: true
},
{
label: 'A way to declare variables in TypeScript.',
is_correct: false
}
]
},
{
title: 'What is a type alias in TypeScript?',
name: 'q2',
points: 1,
order: 2,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'A way to assign a type to a variable.',
is_correct: false
},
{
label: 'A way to create an alias for a type, making it easier to refer to.',
is_correct: true
},
{
label: 'A way to create an instance of a class.',
is_correct: false
},
{
label: 'A way to define interfaces in TypeScript.',
is_correct: false
}
]
},
{
title: 'Which keyword is used to define an interface in TypeScript?',
name: 'q3',
points: 1,
order: 3,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'interface',
is_correct: true
},
{
label: 'class',
is_correct: false
},
{
label: 'type',
is_correct: false
},
{
label: 'alias',
is_correct: false
}
]
},
{
title: 'In TypeScript, can a class implement multiple interfaces?',
name: 'q4',
points: 1,
order: 4,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'No, a class can only implement one interface.',
is_correct: false
},
{
label: 'Yes, a class can implement multiple interfaces.',
is_correct: true
},
{
label: 'Interfaces cannot be implemented by classes in TypeScript.',
is_correct: false
},
{
label: 'Classes in TypeScript do not support interfaces.',
is_correct: false
}
]
},
{
title: 'What is the benefit of using type aliases in TypeScript?',
name: 'q5',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Type aliases provide better performance than interfaces.',
is_correct: false
},
{
label: 'Type aliases are used to create new classes in TypeScript.',
is_correct: false
},
{
label: 'Type aliases make it easier to refer to complex types.',
is_correct: true
},
{
label: 'Type aliases are used to define interfaces in TypeScript.',
is_correct: false
}
]
},
{
title: 'Can you add properties to an object using an interface in TypeScript?',
name: 'q6',
points: 1,
order: 6,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'No, interfaces are only used for type checking.',
is_correct: true
},
{
label: 'Yes, interfaces can be used to add properties to objects.',
is_correct: false
},
{
label: 'Interfaces are not used to work with objects in TypeScript.',
is_correct: false
},
{
label: 'Interfaces can only be used with classes in TypeScript.',
is_correct: false
}
]
},
{
title: 'What is a benefit of using interfaces for function type declarations in TypeScript?',
name: 'q7',
points: 1,
order: 7,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Interfaces are not used for function type declarations in TypeScript.',
is_correct: false
},
{
label: 'Interfaces allow you to define the expected function signature.',
is_correct: true
},
{
label: 'Interfaces make functions easier to call in TypeScript.',
is_correct: false
},
{
label: 'Interfaces add runtime validation to functions in TypeScript.',
is_correct: false
}
]
},
{
title: 'What is the purpose of an index signature in TypeScript?',
name: 'q8',
points: 1,
order: 8,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Index signatures are not used in TypeScript.',
is_correct: false
},
{
label: 'Index signatures define the data types of object properties.',
is_correct: false
},
{
label: 'Index signatures allow dynamic property access on objects.',
is_correct: true
},
{
label: 'Index signatures are used to create new types in TypeScript.',
is_correct: false
}
]
},
{
title: 'Which keyword is used to define a type alias in TypeScript?',
name: 'q9',
points: 1,
order: 9,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'type',
is_correct: true
},
{
label: 'interface',
is_correct: false
},
{
label: 'alias',
is_correct: false
},
{
label: 'class',
is_correct: false
}
]
},
{
title: 'In TypeScript, can you extend multiple type aliases?',
name: 'q10',
points: 1,
order: 10,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'No, you can only extend one type alias at a time.',
is_correct: false
},
{
label: 'Yes, you can extend multiple type aliases in TypeScript.',
is_correct: true
},
{
label: 'Type aliases cannot be extended in TypeScript.',
is_correct: false
},
{
label: 'Type aliases can only be extended by classes in TypeScript.',
is_correct: false
}
]
}
]
}
};
export default template;
@@ -0,0 +1,264 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Union Types Quiz',
description: 'Test your knowledge of TypeScript union types.',
questionnaire: {
questions: [
{
title: 'What are union types used for in TypeScript?',
name: 'q1',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'To define a type that can be one of several types.',
is_correct: true
},
{
label: 'To create a new type by combining two types.',
is_correct: false
},
{
label: 'To define a type that must be all types in the union.',
is_correct: false
},
{
label: 'Union types are not used in TypeScript.',
is_correct: false
}
]
},
{
title: 'How do you declare a union type in TypeScript?',
name: 'q2',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX type
options: [
{
label: 'Using the `union` keyword.',
is_correct: false
},
{
label: 'Using the `|` symbol between type names.',
is_correct: true
},
{
label: 'Using the `&` symbol between type names.',
is_correct: false
},
{
label: 'Using the `type` keyword followed by parentheses.',
is_correct: false
}
]
},
{
title: 'What is the result of a union type that includes `null` or `undefined`?',
name: 'q3',
points: 1,
order: 3,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'The union type cannot include `null` or `undefined`.',
is_correct: false
},
{
label: 'It allows the value to be `null`, `undefined`, or any other specified type.',
is_correct: true
},
{
label: 'It forces the value to be both `null` and `undefined` simultaneously.',
is_correct: false
},
{
label: 'The union type becomes a non-nullable type.',
is_correct: false
}
]
},
{
title: 'Which symbol is used to separate type options in a union type?',
name: 'q4',
points: 1,
order: 4,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Comma (,)',
is_correct: false
},
{
label: 'Semicolon (;)',
is_correct: false
},
{
label: 'Pipe (|)',
is_correct: true
},
{
label: 'Ampersand (&)',
is_correct: false
}
]
},
{
title: 'What is a discriminated union in TypeScript?',
name: 'q5',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'A union type with a single option.',
is_correct: false
},
{
label: 'A union type that combines multiple types without discrimination.',
is_correct: false
},
{
label: 'A union type where each option has a common property to discriminate between them.',
is_correct: true
},
{
label: 'A union type that is only used for numbers.',
is_correct: false
}
]
},
{
title: 'What is the TypeScript keyword for a non-null assertion?',
name: 'q6',
points: 1,
order: 6,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'NotNull',
is_correct: false
},
{
label: 'NonNull',
is_correct: false
},
{
label: 'Undefined',
is_correct: false
},
{
label: '!',
is_correct: true
}
]
},
{
title: 'In a union type, can you access properties that are not common to all types?',
name: 'q7',
points: 1,
order: 7,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Yes, TypeScript allows accessing all properties in a union type.',
is_correct: false
},
{
label: 'No, you can only access properties common to all types in the union.',
is_correct: true
},
{
label: 'It depends on the specific property being accessed.',
is_correct: false
},
{
label: 'You can access properties of one type but not the others.',
is_correct: false
}
]
},
{
title: 'What does the `as` keyword do in TypeScript union types?',
name: 'q8',
points: 1,
order: 8,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'It creates a new union type.',
is_correct: false
},
{
label: 'It converts a type to a different type in the union.',
is_correct: true
},
{
label: 'It enforces strict type checking.',
is_correct: false
},
{
label: 'It is used for optional properties.',
is_correct: false
}
]
},
{
title: 'What is the purpose of the `never` type in TypeScript?',
name: 'q9',
points: 1,
order: 9,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'To define a type that can never have any values.',
is_correct: true
},
{
label: 'To define a type for numeric values only.',
is_correct: false
},
{
label: 'To create a type that is nullable.',
is_correct: false
},
{
label: 'To define a type that can have any value.',
is_correct: false
}
]
},
{
title: 'Can you use TypeScript union types with class constructors?',
name: 'q10',
points: 1,
order: 10,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'Yes, union types can be used with class constructors.',
is_correct: true
},
{
label: 'No, union types are only for primitive types.',
is_correct: false
},
{
label: 'Union types are used with interfaces, not classes.',
is_correct: false
},
{
label: 'Union types cannot be used with functions or classes.',
is_correct: false
}
]
}
]
}
};
export default template;
@@ -0,0 +1,247 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Functions Quiz',
description: 'Test your knowledge of TypeScript functions.',
questionnaire: {
questions: [
{
title: 'What is a function in TypeScript?',
name: 'q1',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'A function is a variable in TypeScript.',
is_correct: false
},
{
label: 'A function is a block of code that can be executed and reused.',
is_correct: true
},
{
label: 'A function is a type of loop in TypeScript.',
is_correct: false
},
{
label: 'A function is a reserved keyword in TypeScript.',
is_correct: false
}
]
},
{
title: 'What is the syntax for defining a function in TypeScript?',
name: 'q2',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX type
options: [
{
label: 'function functionName() { }',
is_correct: true
},
{
label: 'func functionName() { }',
is_correct: false
},
{
label: 'const functionName = () => { }',
is_correct: true
},
{
label: 'def functionName() { }',
is_correct: false
}
]
},
{
title: 'What is a parameter in a function?',
name: 'q3',
points: 1,
order: 3,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'A parameter is a variable declared inside a function.',
is_correct: true
},
{
label: 'A parameter is a function that takes another function as an argument.',
is_correct: false
},
{
label: 'A parameter is the return value of a function.',
is_correct: false
},
{
label: 'A parameter is a built-in keyword in TypeScript.',
is_correct: false
}
]
},
{
title: 'What is the purpose of the `return` statement in a function?',
name: 'q4',
points: 1,
order: 4,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'The `return` statement defines a new function.',
is_correct: false
},
{
label: 'The `return` statement is used to exit a loop.',
is_correct: false
},
{
label: 'The `return` statement specifies the value that the function will return.',
is_correct: true
},
{
label: 'The `return` statement is not used in functions.',
is_correct: false
}
]
},
{
title: 'What is a TypeScript arrow function?',
name: 'q5',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'An arrow function is a function with a circular shape.',
is_correct: false
},
{
label: 'An arrow function is a concise way to write function expressions in TypeScript.',
is_correct: true
},
{
label: 'An arrow function is a type of function that uses arrows instead of parentheses.',
is_correct: false
},
{
label: 'An arrow function is a deprecated feature in TypeScript.',
is_correct: false
}
]
},
{
title: 'What is the purpose of the `this` keyword in a function?',
name: 'q6',
points: 1,
order: 6,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'The `this` keyword refers to the function itself.',
is_correct: false
},
{
label: 'The `this` keyword refers to the global object.',
is_correct: false
},
{
label: 'The `this` keyword refers to the current instance of an object.',
is_correct: true
},
{
label: 'The `this` keyword is not used in functions.',
is_correct: false
}
]
},
{
title: 'What is a TypeScript generator function?',
name: 'q7',
points: 1,
order: 7,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'A generator function is a function that generates random values.',
is_correct: false
},
{
label: 'A generator function is a special type of function that can pause and resume its execution.',
is_correct: true
},
{
label: 'A generator function is a function that generates HTML code.',
is_correct: false
},
{
label: 'A generator function is not a valid TypeScript feature.',
is_correct: false
}
]
},
{
title: 'What is the purpose of the `yield` keyword in a generator function?',
name: 'q8',
points: 1,
order: 8,
question_type: QuestionTypes[0], // RADIO type
options: [
{
label: 'The `yield` keyword is used to yield control back to the caller of the generator function.',
is_correct: true
},
{
label: 'The `yield` keyword is used to terminate the generator function.',
is_correct: false
},
{
label: 'The `yield` keyword has no specific purpose in generator functions.',
is_correct: false
},
{
label: 'The `yield` keyword is used to specify the return value of the generator function.',
is_correct: false
}
]
},
{
title: 'Can a TypeScript function have multiple return statements?',
name: 'q9',
points: 1,
order: 9,
question_type: QuestionTypes[1], // CHECKBOX type
options: [
{
label: 'Yes, a function can have multiple return statements.',
is_correct: true
},
{
label: 'No, a function can only have one return statement.',
is_correct: false
},
{
label: 'It depends on the type of function.',
is_correct: false
},
{
label: 'Multiple return statements are only allowed in arrow functions.',
is_correct: false
}
]
},
{
title: 'What is function overloading in TypeScript?',
name: 'q10',
points: 1,
order: 10,
question_type: QuestionTypes[2], // TEXTAREA type
options: [] // No options for TEXTAREA type
}
]
}
};
export default template;
+132
View File
@@ -0,0 +1,132 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Quiz',
description: 'Test your TypeScript knowledge!',
questionnaire: {
questions: [
{
title: 'What is TypeScript?',
name: 'q1',
points: 2,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'A programming language', is_correct: false },
{ label: 'A superset of JavaScript', is_correct: true },
{ label: 'A text editor', is_correct: false },
],
},
{
title: 'How do you declare a variable in TypeScript?',
name: 'q2',
points: 2,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'var x = 5;', is_correct: false },
{ label: 'let x = 5;', is_correct: true },
{ label: 'const x = 5;', is_correct: false },
],
},
{
title: 'What is the output of 2 + "2" in TypeScript?',
name: 'q3',
points: 2,
order: 3,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: '4', is_correct: false },
{ label: '22', is_correct: true },
{ label: 'TypeError', is_correct: false },
],
},
{
title: 'How do you define an array in TypeScript?',
name: 'q4',
points: 2,
order: 4,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'let arr = [1, 2, 3];', is_correct: true },
{ label: 'const arr = {1, 2, 3};', is_correct: false },
{ label: 'var arr = [1, 2, 3];', is_correct: true },
{ label: 'array arr = [1, 2, 3];', is_correct: false },
],
},
{
title: 'What keyword is used to define a function in TypeScript?',
name: 'q5',
points: 2,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'function', is_correct: true },
{ label: 'method', is_correct: false },
{ label: 'func', is_correct: false },
],
},
{
title: 'How do you typecast in TypeScript?',
name: 'q6',
points: 2,
order: 6,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'What is the purpose of TypeScript?',
name: 'q7',
points: 2,
order: 7,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'To add static typing to JavaScript', is_correct: true },
{ label: 'To replace JavaScript', is_correct: false },
{ label: 'To make JavaScript run faster', is_correct: false },
],
},
{
title: 'How do you define an interface in TypeScript?',
name: 'q8',
points: 2,
order: 8,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'interface MyInterface {}', is_correct: true },
{ label: 'type MyInterface = {};', is_correct: false },
{ label: 'class MyInterface {}', is_correct: false },
{ label: 'interface = MyInterface {};', is_correct: false },
],
},
{
title: 'What is the output of console.log(typeof undefined) in TypeScript?',
name: 'q9',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'undefined', is_correct: true },
{ label: 'null', is_correct: false },
{ label: 'object', is_correct: false },
],
},
{
title: 'How do you define a class in TypeScript?',
name: 'q10',
points: 2,
order: 10,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'class MyClass {}', is_correct: true },
{ label: 'interface MyClass {}', is_correct: false },
{ label: 'type MyClass = {};', is_correct: false },
],
},
],
},
};
export default template;
+133
View File
@@ -0,0 +1,133 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Classes Quiz',
description: 'Test your knowledge of TypeScript classes!',
questionnaire: {
questions: [
{
title: 'What is a class in TypeScript?',
name: 'q1',
points: 2,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'A data structure', is_correct: false },
{ label: 'A blueprint for creating objects', is_correct: true },
{ label: 'A function', is_correct: false },
],
},
{
title: 'How do you define a class in TypeScript?',
name: 'q2',
points: 2,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'class MyClass {}', is_correct: true },
{ label: 'interface MyClass {}', is_correct: false },
{ label: 'type MyClass = {};', is_correct: false },
],
},
{
title: 'What is the keyword used to create an instance of a class in TypeScript?',
name: 'q3',
points: 2,
order: 3,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'new', is_correct: true },
{ label: 'instance', is_correct: false },
{ label: 'create', is_correct: false },
],
},
{
title: 'How do you define a constructor in a TypeScript class?',
name: 'q4',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'constructor()', is_correct: true },
{ label: 'init()', is_correct: false },
{ label: 'create()', is_correct: false },
],
},
{
title: 'In TypeScript, can a class inherit from multiple classes?',
name: 'q5',
points: 2,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Yes', is_correct: true },
{ label: 'No', is_correct: false },
],
},
{
title: 'What is the purpose of the "super" keyword in a subclass constructor?',
name: 'q6',
points: 2,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'To call the constructor of the superclass', is_correct: true },
{ label: 'To create a new instance of the superclass', is_correct: false },
{ label: 'To access static methods of the superclass', is_correct: false },
],
},
{
title: 'How do you mark a class property as private in TypeScript?',
name: 'q7',
points: 2,
order: 7,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'private property;', is_correct: false },
{ label: 'public property;', is_correct: false },
{ label: 'private property: type;', is_correct: true },
],
},
{
title: 'What is the purpose of the "protected" keyword for class members?',
name: 'q8',
points: 2,
order: 8,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'To make members accessible only within the class', is_correct: false },
{ label: 'To make members accessible within subclasses', is_correct: true },
{ label: 'To make members accessible globally', is_correct: false },
],
},
{
title: 'What is the difference between an abstract class and a regular class in TypeScript?',
name: 'q9',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Abstract classes cannot have constructors', is_correct: false },
{ label: 'Abstract classes cannot be instantiated directly', is_correct: true },
{ label: 'Regular classes cannot have methods', is_correct: false },
],
},
{
title: 'How do you define an abstract method in a TypeScript abstract class?',
name: 'q10',
points: 2,
order: 10,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'abstract method();', is_correct: true },
{ label: 'virtual method();', is_correct: false },
{ label: 'function method();', is_correct: false },
],
},
],
},
};
export default template;
@@ -0,0 +1,133 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Generics Quiz',
description: 'Test your knowledge of TypeScript generics!',
questionnaire: {
questions: [
{
title: 'What are generics in TypeScript?',
name: 'q1',
points: 2,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'A type of fruit', is_correct: false },
{ label: 'A way to make functions and classes more reusable', is_correct: true },
{ label: 'A type of loop', is_correct: false },
],
},
{
title: 'How do you declare a generic type parameter in TypeScript?',
name: 'q2',
points: 2,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: '<T>', is_correct: true },
{ label: '[T]', is_correct: false },
{ label: '{T}', is_correct: false },
],
},
{
title: 'What is the purpose of generics in TypeScript?',
name: 'q3',
points: 2,
order: 3,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'To specify the return type of a function', is_correct: false },
{ label: 'To create reusable functions and classes that work with different types', is_correct: true },
{ label: 'To define the structure of an object', is_correct: false },
],
},
{
title: 'How do you use a generic type parameter in a function in TypeScript?',
name: 'q4',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'By enclosing it in square brackets like [T]', is_correct: false },
{ label: 'By enclosing it in angle brackets like <T>', is_correct: true },
{ label: 'By using curly braces like {T}', is_correct: false },
],
},
{
title: 'What is the purpose of specifying a generic type constraint in TypeScript?',
name: 'q5',
points: 2,
order: 5,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'To limit the types that can be used with the generic', is_correct: true },
{ label: 'To allow any type to be used with the generic', is_correct: false },
{ label: 'To specify the default type for the generic', is_correct: false },
],
},
{
title: 'How do you declare a generic class in TypeScript?',
name: 'q6',
points: 2,
order: 6,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'class MyClass<T> {}', is_correct: true },
{ label: 'interface MyClass<T> {}', is_correct: false },
{ label: 'type MyClass<T> = {};', is_correct: false },
],
},
{
title: 'What is the purpose of the "extends" keyword in a generic type constraint?',
name: 'q7',
points: 2,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'To specify a type that the generic type parameter must extend', is_correct: true },
{ label: 'To specify a type that the generic type parameter must be equal to', is_correct: false },
{ label: 'To specify a type that the generic type parameter must not extend', is_correct: false },
],
},
{
title: 'Can you use generics with TypeScript arrays?',
name: 'q8',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'No, generics can only be used with classes', is_correct: false },
{ label: 'Yes, you can create generic arrays', is_correct: true },
],
},
{
title: 'What is the benefit of using generics with TypeScript arrays?',
name: 'q9',
points: 2,
order: 9,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'Allows you to specify the type of elements in the array', is_correct: true },
{ label: 'Makes arrays faster', is_correct: false },
{ label: 'Prevents you from using arrays', is_correct: false },
],
},
{
title: 'What is the syntax for using generics with TypeScript functions?',
name: 'q10',
points: 2,
order: 10,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'function myFunction<T>() {}', is_correct: true },
{ label: 'function myFunction: <T>() => {}', is_correct: false },
{ label: 'function myFunction => <T>() {}', is_correct: false },
],
},
],
},
};
export default template;
@@ -0,0 +1,137 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Utility Types Quiz',
description: 'Test your knowledge of TypeScript utility types!',
questionnaire: {
questions: [
{
title: 'What are TypeScript utility types?',
name: 'q1',
points: 2,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Built-in TypeScript types', is_correct: true },
{ label: 'JavaScript utility functions', is_correct: false },
{ label: 'Custom types defined by developers', is_correct: false },
],
},
{
title: 'Which TypeScript utility type is used to create a new type that is a subset of an existing type?',
name: 'q2',
points: 2,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Partial', is_correct: false },
{ label: 'Pick', is_correct: false },
{ label: 'Omit', is_correct: false },
{ label: 'Subset', is_correct: true },
],
},
{
title: 'What does the TypeScript utility type "Partial" do?',
name: 'q3',
points: 2,
order: 3,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Makes a type required', is_correct: false },
{ label: 'Makes a type optional', is_correct: true },
{ label: 'Creates a union type', is_correct: false },
],
},
{
title: 'Which TypeScript utility type allows you to pick specific properties from an object type?',
name: 'q4',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Partial', is_correct: false },
{ label: 'Pick', is_correct: true },
{ label: 'Omit', is_correct: false },
],
},
{
title: 'How do you use the TypeScript utility type "Record" to define a dictionary type?',
name: 'q5',
points: 2,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Record<string, T>', is_correct: true },
{ label: 'Record<T, string>', is_correct: false },
{ label: 'Record<key, value>', is_correct: false },
],
},
{
title: 'Which TypeScript utility type removes specific properties from an object type?',
name: 'q6',
points: 2,
order: 6,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Partial', is_correct: false },
{ label: 'Pick', is_correct: false },
{ label: 'Omit', is_correct: true },
],
},
{
title: 'What is the purpose of the TypeScript utility type "Required"?',
name: 'q7',
points: 2,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'Makes all properties in a type required', is_correct: true },
{ label: 'Makes all properties in a type optional', is_correct: false },
{ label: 'Creates a new type with some required properties', is_correct: false },
],
},
{
title: 'Which TypeScript utility type is used to create a new type that is the opposite of the specified type?',
name: 'q8',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Partial', is_correct: false },
{ label: 'Required', is_correct: false },
{ label: 'Exclude', is_correct: true },
{ label: 'Extract', is_correct: false },
],
},
{
title: 'What is the purpose of the TypeScript utility type "Exclude"?',
name: 'q9',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Includes specific properties in a type', is_correct: false },
{ label: 'Excludes specific properties from a type', is_correct: true },
{ label: 'Creates a union type', is_correct: false },
],
},
{
title: 'Which TypeScript utility type is used to create a new type that is the intersection of the specified types?',
name: 'q10',
points: 2,
order: 10,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Partial', is_correct: false },
{ label: 'Required', is_correct: false },
{ label: 'Exclude', is_correct: false },
{ label: 'Extract', is_correct: true },
],
},
],
},
};
export default template;
+132
View File
@@ -0,0 +1,132 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript keyof Quiz',
description: 'Test your knowledge of TypeScript keyof!',
questionnaire: {
questions: [
{
title: 'What does the "keyof" keyword do in TypeScript?',
name: 'q1',
points: 2,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Creates a new key in an object', is_correct: false },
{ label: 'Returns an array of keys from an object', is_correct: false },
{ label: 'Returns a union of keys from an object', is_correct: true },
],
},
{
title: 'How do you use the "keyof" keyword to access the keys of an object type?',
name: 'q2',
points: 2,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'keyof object', is_correct: true },
{ label: 'object.keys', is_correct: false },
{ label: 'object.keys()', is_correct: false },
],
},
{
title: 'What is the type of a variable declared using the "keyof" keyword?',
name: 'q3',
points: 2,
order: 3,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'string', is_correct: true },
{ label: 'number', is_correct: false },
{ label: 'boolean', is_correct: false },
],
},
{
title: 'In TypeScript, can you use "keyof" with object instances?',
name: 'q4',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Yes, "keyof" works with both object types and instances', is_correct: false },
{ label: 'No, "keyof" only works with object types', is_correct: true },
],
},
{
title: 'What is the purpose of using "keyof" with mapped types in TypeScript?',
name: 'q5',
points: 2,
order: 5,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'To create new keys in an object', is_correct: false },
{ label: 'To create a union of keys from multiple objects', is_correct: true },
{ label: 'To filter out specific keys from an object', is_correct: false },
],
},
{
title: 'How do you use "keyof" with generic types in TypeScript?',
name: 'q6',
points: 2,
order: 6,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'keyof T', is_correct: true },
{ label: 'keyof<T>', is_correct: false },
{ label: 'keyof(T)', is_correct: false },
],
},
{
title: 'Which of the following is a valid use case for "keyof" in TypeScript?',
name: 'q7',
points: 2,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'Creating new object keys', is_correct: false },
{ label: 'Accessing the values of an object', is_correct: false },
{ label: 'Accessing object keys as string literals', is_correct: true },
],
},
{
title: 'What is the return type of the "keyof" keyword in TypeScript?',
name: 'q8',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'string', is_correct: true },
{ label: 'number', is_correct: false },
{ label: 'boolean', is_correct: false },
],
},
{
title: 'In TypeScript, is "keyof" limited to object types, or can it also be used with other types?',
name: 'q9',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'It can only be used with object types', is_correct: false },
{ label: 'It can be used with any type', is_correct: true },
],
},
{
title: 'What is the purpose of "keyof" in TypeScript when working with type constraints?',
name: 'q10',
points: 2,
order: 10,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'To limit the type of keys that can be accessed', is_correct: false },
{ label: 'To specify which keys are required in an object', is_correct: false },
{ label: 'To ensure that a key exists in a given type', is_correct: true },
],
},
],
},
};
export default template;
+134
View File
@@ -0,0 +1,134 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Null and Undefined Quiz',
description: 'Test your knowledge of TypeScript null and undefined!',
questionnaire: {
questions: [
{
title: 'What is the value of a variable that has been declared but not assigned in TypeScript?',
name: 'q1',
points: 2,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'null', is_correct: false },
{ label: 'undefined', is_correct: true },
{ label: '0', is_correct: false },
],
},
{
title: 'What is the difference between null and undefined in TypeScript?',
name: 'q2',
points: 2,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'There is no difference; they are the same.', is_correct: false },
{ label: 'null represents an intentional absence of any object value, while undefined represents a variable that has been declared but not assigned.', is_correct: true },
{ label: 'null is a number with a value of zero, while undefined is a number with a value of NaN.', is_correct: false },
],
},
{
title: 'How can you explicitly set a variable to have a value of null in TypeScript?',
name: 'q3',
points: 2,
order: 3,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Using the "undefined" keyword', is_correct: false },
{ label: 'By assigning the value null to the variable', is_correct: true },
{ label: 'By using the "NaN" keyword', is_correct: false },
],
},
{
title: 'Which of the following statements is true about the "undefined" type in TypeScript?',
name: 'q4',
points: 2,
order: 4,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'It represents the absence of a value', is_correct: true },
{ label: 'It is a subtype of all other types', is_correct: true },
{ label: 'It is the same as "null"', is_correct: false },
{ label: 'It cannot be assigned to a variable', is_correct: false },
],
},
{
title: 'In TypeScript, how do you check if a variable is null or undefined?',
name: 'q5',
points: 2,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Using the "void" keyword', is_correct: false },
{ label: 'Using the "isNullOrUndefined" function', is_correct: false },
{ label: 'Using strict equality operators (===)', is_correct: true },
],
},
{
title: 'What does the "nullish coalescing operator (??)" do in TypeScript?',
name: 'q6',
points: 2,
order: 6,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'It performs bitwise operations on null and undefined values', is_correct: false },
{ label: 'It throws an error when used with null or undefined values', is_correct: false },
{ label: 'It returns the right-hand operand if the left-hand operand is null or undefined, otherwise it returns the left-hand operand', is_correct: true },
],
},
{
title: 'What is the value of a variable that has not been declared in TypeScript?',
name: 'q7',
points: 2,
order: 7,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'null', is_correct: false },
{ label: 'undefined', is_correct: false },
{ label: 'An error is thrown', is_correct: true },
],
},
{
title: 'How do you assign a variable to be explicitly undefined in TypeScript?',
name: 'q8',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Using the "null" keyword', is_correct: false },
{ label: 'By not assigning any value to the variable', is_correct: false },
{ label: 'By assigning the value undefined to the variable', is_correct: true },
],
},
{
title: 'What does the "void" keyword represent in TypeScript?',
name: 'q9',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'An empty value', is_correct: true },
{ label: 'A null value', is_correct: false },
{ label: 'An undefined value', is_correct: false },
],
},
{
title: 'In TypeScript, can you use "undefined" as a variable name?',
name: 'q10',
points: 2,
order: 10,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Yes, "undefined" is a valid variable name', is_correct: true },
{ label: 'No, "undefined" is a reserved keyword and cannot be used as a variable name', is_correct: false },
],
},
],
},
};
export default template;
@@ -0,0 +1,134 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'TypeScript Definitely Typed Quiz',
description: 'Test your knowledge of TypeScript Definitely Typed!',
questionnaire: {
questions: [
{
title: 'What is TypeScript Definitely Typed?',
name: 'q1',
points: 2,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'A built-in TypeScript feature', is_correct: false },
{ label: 'A website that hosts TypeScript libraries with type definitions', is_correct: true },
{ label: 'A TypeScript compiler option', is_correct: false },
],
},
{
title: 'What is the purpose of Definitely Typed in TypeScript?',
name: 'q2',
points: 2,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'To create new TypeScript language features', is_correct: false },
{ label: 'To provide type definitions for JavaScript libraries', is_correct: true },
{ label: 'To optimize TypeScript code for performance', is_correct: false },
],
},
{
title: 'How do you install type definitions for a library using Definitely Typed?',
name: 'q3',
points: 2,
order: 3,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'By running "npm install @types/library-name"', is_correct: true },
{ label: 'By manually copying and pasting type definitions into your project', is_correct: false },
{ label: 'By using the "tsc" command with a special flag', is_correct: false },
],
},
{
title: 'Which TypeScript compiler option is used to automatically download type definitions for a library?',
name: 'q4',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: '--download-types', is_correct: false },
{ label: '--include-types', is_correct: false },
{ label: '--types', is_correct: true },
],
},
{
title: 'What is the file extension for Definitely Typed type definition files?',
name: 'q5',
points: 2,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: '.d.ts', is_correct: true },
{ label: '.ts', is_correct: false },
{ label: '.def', is_correct: false },
],
},
{
title: 'In a Definitely Typed type definition file, what does the "declare" keyword indicate?',
name: 'q6',
points: 2,
order: 6,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'That the type definition is private and cannot be accessed', is_correct: false },
{ label: 'That the type definition is for external code and not part of the current project', is_correct: true },
{ label: 'That the type definition is for internal code and should not be used externally', is_correct: false },
],
},
{
title: 'What is the primary benefit of using Definitely Typed in TypeScript projects?',
name: 'q7',
points: 2,
order: 7,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'It reduces the size of the compiled JavaScript files', is_correct: false },
{ label: 'It ensures that all code is written in TypeScript', is_correct: false },
{ label: 'It provides type safety and auto-completion for JavaScript libraries', is_correct: true },
],
},
{
title: 'Which command is used to search for type definitions on Definitely Typed?',
name: 'q8',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'npm search @types', is_correct: false },
{ label: 'npm install @types', is_correct: false },
{ label: 'npx search-definitely-typed', is_correct: true },
],
},
{
title: 'What should you do if there is no available Definitely Typed type definition for a library?',
name: 'q9',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Manually create your own type definition file', is_correct: true },
{ label: 'Abandon the use of the library in your project', is_correct: false },
{ label: 'Use the "any" type to bypass type checking', is_correct: false },
],
},
{
title: 'How can you contribute to Definitely Typed by providing type definitions for a library?',
name: 'q10',
points: 2,
order: 10,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Submit a pull request to the Definitely Typed repository with your type definitions', is_correct: true },
{ label: 'Send an email to the Definitely Typed maintainers', is_correct: false },
{ label: 'Post the type definitions on a personal blog', is_correct: false },
],
},
],
},
};
export default template;
+55
View File
@@ -0,0 +1,55 @@
import tsSimpleTypes from './001_ts_simpleTypes';
import tsSpecialTypes from './002_ts_specialTypes';
import tsArrays from './003_ts_arrays';
import tsTuples from './004_ts_tuples';
import tsObjectTypes from './005_ts_objectTypes';
import tsEnums from './006_ts_enums';
import tsInterfaces from './007_ts_interfaces';
import tsUnionTypes from './008_ts_unionTypes';
import tsFunctions from './009_ts_functions';
import tsCasting from './010_ts_casting';
import tsClasses from './011_ts_classes';
import tsBasicGenerics from './012_ts_basicGenerics';
import tsUtilityTypes from './013_ts_utilityTypes';
import tsKeyOf from './014_ts_keyOf';
import tsNull from './015_ts_null';
import tsDefinitelyTyped from './016_ts_definitelyTyped';
export const TS_IDS: { [key: string]: string } = {
TS_SIMPLETYPES: 'TS_SIMPLETYPES',
TS_SPECIALTYPES: 'TS_SPECIALTYPES',
TS_ARRAYS: 'TS_ARRAYS',
TS_TUPLES: 'TS_TUPLES',
TS_OBJECTTYPES: 'TS_OBJECTTYPES',
TS_ENUMS: 'TS_ENUMS',
TS_INTERFACES: 'TS_INTERFACES',
TS_UNIONTYPES: 'TS_UNIONTYPES',
TS_FUNCTIONS: 'TS_FUNCTIONS',
TS_CASTING: 'TS_CASTING',
TS_CLASSES: 'TS_CLASSES',
TS_BASICGENERICS: 'TS_BASICGENERICS',
TS_UTILITYTYPES: 'TS_UTILITYTYPES',
TS_KEYOF: 'TS_KEYOF',
TS_NULL: 'TS_NULL',
TS_DEFINITELYTYPED: 'TS_DEFINITELYTYPED',
};
export const TS_TEMPLATES = {
[TS_IDS.TS_SIMPLETYPES]: tsSimpleTypes,
[TS_IDS.TS_SPECIALTYPES]: tsSpecialTypes,
[TS_IDS.TS_ARRAYS]: tsArrays,
[TS_IDS.TS_TUPLES]: tsTuples,
[TS_IDS.TS_OBJECTTYPES]: tsObjectTypes,
[TS_IDS.TS_ENUMS]: tsEnums,
[TS_IDS.TS_INTERFACES]: tsInterfaces,
[TS_IDS.TS_UNIONTYPES]: tsUnionTypes,
[TS_IDS.TS_FUNCTIONS]: tsFunctions,
[TS_IDS.TS_CASTING]: tsCasting,
[TS_IDS.TS_CLASSES]: tsClasses,
[TS_IDS.TS_BASICGENERICS]: tsBasicGenerics,
[TS_IDS.TS_UTILITYTYPES]: tsUtilityTypes,
[TS_IDS.TS_KEYOF]: tsKeyOf,
[TS_IDS.TS_NULL]: tsNull,
[TS_IDS.TS_DEFINITELYTYPED]: tsDefinitelyTyped,
};