{"pageProps":{"code":{"example_aliases.ts":{"name":"example_aliases.ts","content":"type ListItem = string | number;\n\nfunction create10List(item: ListItem) {\n  const arr: ListItem[] = [];\n  for (let i = 0; i < 10; i++) {\n    arr.push(item);\n  }\n  return arr;\n}\n","path":"code/1531/24T1/3.3/example_aliases.ts","fileext":"ts"},"example_any.ts":{"name":"example_any.ts","content":"// @ts-nocheck\n\nfunction hello(name: any): any {\n  return `Hello ${name}!`;\n}\n\nfunction substring(str: any, start: any, end: any) {\n  return null;\n}\n\ntype Person = any;\nconst person: Person = {\n  name: 'Hayden',\n};\n","path":"code/1531/24T1/3.3/example_any.ts","fileext":"ts"},"example_functions.ts":{"name":"example_functions.ts","content":"function hello(name: string): string {\n  return `Hello ${name}!`;\n}\n","path":"code/1531/24T1/3.3/example_functions.ts","fileext":"ts"},"example_lists.ts":{"name":"example_lists.ts","content":"function create10List(item: string | number) {\n  const arr: Array<string | number> = [];\n  for (let i = 0; i < 10; i++) {\n    arr.push(item);\n  }\n  return arr;\n}\n","path":"code/1531/24T1/3.3/example_lists.ts","fileext":"ts"},"example_literals.ts":{"name":"example_literals.ts","content":"type visibility = 'Private' | 'Public';\n\nfunction createChannel(name: string, visibility: visibility) {\n  // Do things\n}\n","path":"code/1531/24T1/3.3/example_literals.ts","fileext":"ts"},"example_objects.ts":{"name":"example_objects.ts","content":"type Person = {\n  name: string;\n  age?: number;\n  height?: number;\n}\n\nconst person: Person = {\n  name: 'Hayden',\n};\n\nperson.age = 5;\n","path":"code/1531/24T1/3.3/example_objects.ts","fileext":"ts"},"example_optionals.ts":{"name":"example_optionals.ts","content":"// Note:\n//   end?: number\n// = end: number | undefined\n\nfunction substring(str: string, start: number, end?: number) {\n  let newString = '';\n  const modifiedEnd = end || str.length;\n  // ^ What about end ?? str.length\n  for (let i = start; i < modifiedEnd; i++) {\n    newString += str[i];\n  }\n  return newString;\n}\n\nconsole.log(substring('hayden', 0, 3));\nconsole.log(substring('hayden', 2));\n","path":"code/1531/24T1/3.3/example_optionals.ts","fileext":"ts"},"example_unions.ts":{"name":"example_unions.ts","content":"function printIfReady(ready: boolean | number) {\n  if (ready === true || (!ready && ready !== 0)) {\n    console.log('Ready!');\n  }\n}\nprintIfReady(1);\nprintIfReady(2);\nprintIfReady(0);\nprintIfReady(true);\nprintIfReady(false);\n","path":"code/1531/24T1/3.3/example_unions.ts","fileext":"ts"},"gitlab-ci_type.yml":{"name":"gitlab-ci_type.yml","content":"image: comp1531/basic:latest\n\nstages:\n  - checks\n\ntesting:\n  stage: checks\n  script:\n    - npm run test\n\ntypecheck:\n  stage: checks\n  script:\n    - npm run tsc\n","path":"code/1531/24T1/3.3/gitlab-ci_type.yml","fileext":"yml"},"jest.config.js":{"name":"jest.config.js","content":"module.exports = {\n  preset: 'ts-jest',\n  testEnvironment: 'node',\n  maxWorkers: 1,\n};\n","path":"code/1531/24T1/3.3/jest.config.js","fileext":"js"},"many_string_rude.js":{"name":"many_string_rude.js","content":"function manyString(repeat, str) {\n  let outString = '';\n  for (let i = 0; i < repeat; i++) {\n    outString += str;\n  }\n  return outString;\n}\nconsole.log(manyString('hello ', 5));\n","path":"code/1531/24T1/3.3/many_string_rude.js","fileext":"js"},"many_string_runtime.js":{"name":"many_string_runtime.js","content":"function manyString(repeat, str) {\n  if (!(repeat instanceof 'number')) {\n    console.error('repeat argument is not a number');\n    return undefined;\n  }\n  if (!(str instanceof 'string')) {\n    console.error('str argument is not a string');\n    return undefined;\n  }\n  let outString = '';\n  for (let i = 0; i < repeat; i++) {\n    outString += str;\n  }\n  return outString;\n}\nconsole.log(manyString('hello ', 5));\n","path":"code/1531/24T1/3.3/many_string_runtime.js","fileext":"js"},"mycode.ts":{"name":"mycode.ts","content":"function sum(a: number, b: number) {\n  return a + b;\n}\nconsole.log(sum(1, 2));\n","path":"code/1531/24T1/3.3/mycode.ts","fileext":"ts"},"mycode_broken.ts":{"name":"mycode_broken.ts","content":"function manyString(repeat: number, str: string) {\n  let outString = '';\n  for (let i = 0; i < repeat; i++) {\n    outString += str;\n  }\n  return outString;\n}\nconsole.log(manyString('hello ', 5));\n","path":"code/1531/24T1/3.3/mycode_broken.ts","fileext":"ts"},"package.json":{"name":"package.json","content":"{\n  \"name\": \"env2\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"jest src\",\n    \"tsc\": \"tsc --noImplicitAny\",\n    \"lint\": \"eslint src/**.ts\",\n    \"lint-fix\": \"eslint --fix src/**.ts\",\n    \"ts-node\": \"ts-node\",\n    \"jest\": \"jest\",\n    \"nodemon\": \"nodemon\",\n    \"ts-node-coverage\": \"nyc --reporter=text --reporter=lcov ts-node\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"devDependencies\": {\n    \"@types/express\": \"^4.17.13\",\n    \"@types/http-errors\": \"^1.8.2\",\n    \"@types/jest\": \"^27.5.0\",\n    \"@types/node\": \"^17.0.27\",\n    \"@types/prompt-sync\": \"^4.1.1\",\n    \"@typescript-eslint/eslint-plugin\": \"^5.21.0\",\n    \"@typescript-eslint/parser\": \"^5.21.0\",\n    \"eslint\": \"^8.14.0\",\n    \"eslint-plugin-jest\": \"^26.1.5\",\n    \"jest\": \"^28.1.0\",\n    \"middleware-http-errors\": \"^0.1.0\",\n    \"nodemon\": \"^2.0.16\",\n    \"nyc\": \"^15.1.0\",\n    \"ts-jest\": \"^28.0.2\",\n    \"typescript\": \"^4.6.3\"\n  },\n  \"dependencies\": {\n    \"express\": \"^4.18.0\",\n    \"http-errors\": \"^2.0.0\",\n    \"sync-request\": \"^6.1.0\",\n    \"ts-node\": \"^10.7.0\"\n  }\n}\n","path":"code/1531/24T1/3.3/package.json","fileext":"json"},"tsconfig.json":{"name":"tsconfig.json","content":"{\n    \"compilerOptions\": {\n        \"esModuleInterop\": true,\n        \"noImplicitAny\": false,\n        \"noEmit\": true,\n        \"resolveJsonModule\": true\n    },\n    \"exclude\": [\n      \"**/**_broken.ts\"\n    ]\n}\n\n","path":"code/1531/24T1/3.3/tsconfig.json","fileext":"json"}}},"__N_SSG":true}