Q8. Stock (15 Marks)
Based on the JSDoc function header comments and your understanding of the
function, modify q8/stock.ts
such that it is type-safe and lint free.
- You must type all function parameters.
- You must type all function return types.
- You must fix wrong function parameter types to match the given JSDoc.
- You may create interfaces or type aliases in the main file.
- You should NOT modify variable names, function prototypes, function parameters, nor any logic. You can validate this by checking all provided tests pass.
Marking
When you think your program is working, you can run some simple automated tests:
- type-saftey:
npm run tsc
- lint:
npm run lint
- tests:
npm run test
You are not allowed to use comments which disable lint and type-check in your code - these will result in an automatic zero mark. This includes: eslint-disable, eslint-disable-line, @ts-ignore, @ts-expect-error, etc.
Submission
The submission will only collect the q8/stock.ts
file. All other files are replaced in automarking.
When you've finished working, submit your answer by running:
submit --question 8
If no submissions have been made for a question, we will take the saved file/s from your working directory.