Strictly Speaking
A Learning TypeScript > Configuration Options 🍲 entree project.
Salutations. I am Strictus Typus the Fourth, compiler of the Roman TypeScript armies. My legions are spreading rapidly through the content, conquering as they go.
The masses long for inspiration. Thus it is inspiration I must give them.
Yet, I am not a leader through speech. I am a leader through action. Of conquering soldiery. Of brave deeds and noble intentions, spoken softly so as to not sharply jut out with overt obviousness.
Will you repair for me this speechwriter program?
I fear it was originally written without TypeScript's --noImplicitAny
or --strictNullChecks
modes.
You must restore strict type safety -undefined
and all- that it may run justly and without type errors.
Setup
If you haven't yet, set up the github.com/LearningTypeScript/projects repository locally.
shell
git clone https://github.com/LearningTypeScript/projects learning-typescript-projectscd learning-typescript-projectsnpm i
shell
git clone https://github.com/LearningTypeScript/projects learning-typescript-projectscd learning-typescript-projectsnpm i
Open your editor in this project's directory:
shell
code projects/configuration-options/strictly-speaking
shell
code projects/configuration-options/strictly-speaking
In your terminal, run the TypeScript compiler via the tsc
script.
For example, to start the TypeScript compiler in watch mode:
shell
npm run tsc -- --watch
shell
npm run tsc -- --watch
Files
index.ts
: Add type annotations hereindex.solution.ts
Solution code
Notes
Note: your terminal should be in the
strictly-speaking
directory, not the root repository's directory.
- Don't use
any
or leave any implicitany
s. - Don't change any runtime code behavior. You're just working in the type system.