Where to find answers: docs, MDN, and AI assistants used wisely
Know which of MDN, the TypeScript docs and the Node.js docs answers which question, read a reference page from title to compatibility table, and turn an error into a search. Ask an AI assistant with the whole picture, and check every answer with tsc, a run and the docs before you keep it. Closes Module 1 with its cheat sheet.
TypeScript
Tooling
Where to find answers: docs, MDN, and AI assistants used wisely. Read this lesson at .
Tested with TypeScript 7.x · Node.js LTS
At the end of the last lesson you broke index.ts once more and
read the message without panic. Reading a message is half of the
job. The other half starts when the message uses a word you have
never met, such as argument or parameter, or when there is no
message at all, only a question: TaskKit's banner has two lines of
28 equals signs, typed by hand and counted twice. Can the computer
make that line for you?
Nobody carries a whole language in their head, and people who program
for a living look things up every day. Think of a dictionary and a
well-read friend. The dictionary is slow and always right; the friend
answers at once and is sometimes wrong with complete confidence.
Documentation is the dictionary, and an AI (artificial intelligence)
assistant is the friend. By the end of this lesson you will know which
of three sites answers which question, how to read a reference page
from top to bottom, how to turn an error into a search, and how to ask
an assistant in a way you can check. And TaskKit's banner will build
its line from a single character.
Three places, three kinds of question
Documentation, or docs, is the official description of a
language or a tool, written by the people who make it or look
after it. Its most useful part is the reference: one page for
each thing the language or tool provides, saying exactly what it
does, what it needs and what it gives back. A blog post or a
video can be out of date or simply wrong. A reference page is
where those authors go to check.
TypeScript, JavaScript and Node each have their own docs, and each
answers its own kind of question. JavaScript's are MDN (short
for Mozilla Developer Network, an old name of the site), from
Mozilla, the makers of the Firefox browser. A built-in is
something JavaScript or the browser already provides, ready to use,
such as console.log. The figure also uses repeat(), which makes
copies of a piece of text, and //, which starts a note for people:
everything after it on the line is not run, and here it shows the
result. All three come up again below.
"=".repeat(3); // '==='
MDN
Does:
Explains JavaScript: every built‑in, console.log and repeat()
included
Never: It does not explain TypeScript's checks
"=".repeat();
Expected 1 arguments, but got 0.
TypeScript docs
Does:
Explains what TypeScript adds: types, the check, tsc and its
flags
Never: It has no page for each error code
% node --version
v24.11.1
%
Node.js docs
Does:
Explains node itself: its flags, and what only Node can do
Never: It does not teach the JavaScript language
Three places to look, each for its own kind of question
"=".repeat(3); // '==='
MDN
Does:
Explains JavaScript: every built‑in, console.log and repeat()
included
Never: It does not explain TypeScript's checks
"=".repeat();
Expected 1 arguments, but got 0.
TypeScript docs
Does:
Explains what TypeScript adds: types, the check, tsc and its
flags
Never: It has no page for each error code
PS C:\Users\ana> node --version
v24.11.1
PS C:\Users\ana>
Node.js docs
Does:
Explains node itself: its flags, and what only Node can do
Never: It does not teach the JavaScript language
Three places to look, each for its own kind of question
"=".repeat(3); // '==='
MDN
Does:
Explains JavaScript: every built‑in, console.log and repeat()
included
Never: It does not explain TypeScript's checks
"=".repeat();
Expected 1 arguments, but got 0.
TypeScript docs
Does:
Explains what TypeScript adds: types, the check, tsc and its
flags
Never: It has no page for each error code
$ node --version
v24.11.1
$
Node.js docs
Does:
Explains node itself: its flags, and what only Node can do
Never: It does not teach the JavaScript language
Three places to look, each for its own kind of question
MDN, at developer.mozilla.org,
describes JavaScript and everything a web browser adds to it. Since
TypeScript is JavaScript plus a check, most "how do I…?" questions
are JavaScript questions, and MDN is where they are answered: how to
make text upper case, how to round a number, what console.log does
with several values.
The TypeScript docs, at
typescriptlang.org/docs,
keep a Handbook, a long guide you can read in order; you will
open it more and more from the next module on, when types (the kinds
of value, such as text or a number) arrive.
The Node.js docs, at
nodejs.org/docs, come
in one edition per version. node --version printed a version
starting with v24, so open the v24 edition: the link above goes
straight to it, and the Other versions list on every page
switches between them.
Read a reference page
Here is the question from the start of the lesson, put to MDN.
Searching mdn string repeat leads to a page called
String.prototype.repeat(). The name looks alarming, and only
its two ends matter: String says it works on text, and
repeat() is its name. The word in the middle, prototype, you
can skip for now: it says that every piece of text has
repeat().
Every reference page on MDN is laid out the same way, so you
learn to read one and can read them all. This is what each part
of the repeat() page tells you:
String.prototype.repeat()
The title. String means it works on text; its first sentence
says what it does.
Syntax
repeat(count): the shape to write, with a value in the
brackets.
Parameters
count: "An integer between 0 and Infinity". A number, not
text.
Return value
"A new string containing the specified number of copies".
Examples
"abc".repeat(2); // 'abcabc': what it gives, one line each.
Browser compatibility
The table's Node.js column says: full support, since Node.js 4.
MDN's page for repeat(): what each part tells you
Read the first sentence, the Syntax and the Examples first: they are
usually enough. Parameters and Return value are where you go when
something does not work. The page also opens with a short example
under Try it; Specifications, just before the compatibility
table, and See also, at the very end, you can leave for later.
A string is what programmers call a piece of text. You write
repeat() the way you already write console.log: the value,
a dot, the name, and what it needs in the brackets. So
"=".repeat(28) is the text "=", repeated 28 times. Put it to
work in the banner. Press Run:
index.tsts
const version = "0.1";const line = "=".repeat(28);console.log(line);console.log("TaskKit", version);console.log("Your tasks, in your terminal");console.log(line);
The line is made once, kept in a box called line, and printed
twice. To make the banner wider, you now change one number in one
place instead of counting equals signs on two lines. Copy this
into your own index.ts, then check it and run it as in the last
two lessons.
The words in an error message
Suppose you had typed the count in quotes, as "28". Check the
file with tsc (short for TypeScript compiler), which npx
starts from your taskkit folder:
bash
npx tsc --noEmit index.ts
Outputtext
index.ts:2:25 - error TS2345: Argument of type 'string' isnot assignable to parameter of type 'number'.2 const line = "=".repeat("28"); ~~~~Found 1 error in index.ts:2
The first line is one long line in your terminal, broken in two
here to fit the page. The five questions from the last lesson
find the place: TypeScript, line 2, column 25, under "28". But
the sentence is made of words you have not met. Take them one at
a time, and the reference page answers each one:
A parameter is a value a built-in such as repeat() expects
in its brackets, as its page names it. repeat() has one, count.
An argument is the value you actually put there. Yours is
"28".
A type is the kind of a value. 'string' is text, and
'number' is a number. The quotes make "28" text, exactly as
quotes made "Groceries" text in the first lesson.
Not assignable to means "does not fit". Your text does not fit
a slot meant for a number, which is what Parameters said:
"An integer", a whole number (Infinity there means "as many as
you like").
Remove the quotes and the check prints nothing. Node, as it
happens, would have run the quoted version and printed the right
banner, because JavaScript quietly turns "28" into 28. TypeScript
holds you to what the reference page says, and that habit is what
catches the cases where the quiet guess goes wrong.
When the reference page does not explain an error, search for
it. What you type decides what you find.
Bad — describes the trouble in
your own words, with your own names in it.
Searchtext
typescript my line variable repeat not working index.ts
Good — the error's code and the
part of its sentence that is the same for everyone.
Searchtext
typescript TS2345 is not assignable to parameter of type
Nobody else's program has a box called line in a file called
index.ts, so your own names narrow the results down to pages
about other people's problems. TS2345 and the sentence are the
same in every project in the world. When a result looks right,
read its question before its answer: is it the same error, and
the same language?
Ask an AI assistant
An AI assistant is a chat program that writes answers in
plain language. It has learned from an enormous amount of text,
code included, so it can explain an error, suggest a fix, or
answer a question about MDN's page in other words. It is fast,
and it never tires of a beginner's question.
It also has three blind spots. It does not run your code on your
computer, so it cannot see what really happens there. It sees
nothing on your computer that you do not paste in: not your file,
not your versions. And it writes what an answer usually looks like,
so it sounds just as sure when it is wrong. Treat it like the
well-read friend: a fine first explanation, never the last word.
What you send decides what you get back.
Bad — leaves the assistant to
guess the code, the message, the language and the versions.
Your messagetext
my code doesnt work, fix it
Good — the versions, the exact
line, the exact message, and a request to explain before fixing.
Your messagetext
I am learning TypeScript 7 with Node 24.This line: const line = "=".repeat("28");gives this error from npx tsc --noEmit: error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.Explain what the error means, then show the fix.
The first message gets a guess about some other program. The
second gets an answer about yours, and "explain, then fix" means
you learn why, so next time you will not need to ask. Try a
problem yourself for a few minutes before you ask at all: the
minutes you are stuck are the ones in which you learn.
Check every answer
Here is what can go wrong, with the banner's line. Suppose you
had asked an assistant how to print 28 equals signs without typing
them, and it answered, at once and sure of itself:
ts
const line = "=" * 28;
In code, * means times, and multiplying text by a number is how
Python, a different language, makes copies. In JavaScript it gives
NaN, short for "not a number", and what it costs depends on what
you do next. Press Next step to walk through it, or let it play,
and switch between the two ways of handling the answer:
You
AIassistant
TypeScript
Node
You: ask for the lineaskforthelineaskfortheline
AI assistant: "=" * 28"="*28"="*28
TypeScript: never askedneveraskedneverasked
Node: prints NaNprintsNaNprintsNaN
You: hunt for NaNhuntforNaNhuntforNaN
Time
You ask how to print 28 equals signs without typing them.
It answers at once, sure of itself: const line = "=" * 28;.
You pasted the answer and ran it, so nothing checked it.
No error at all: every line runs, and the banner's lines print
NaN.
No message names a line. You have only the wrong output to go
on.
An assistant's answer is a suggestion until the check passes
All 5 steps shown.Step 1 of 5: You: ask for the lineStep 2 of 5: AI assistant: "=" * 28Step 3 of 5: TypeScript: never askedStep 4 of 5: Node: prints NaNStep 5 of 5: You: hunt for NaN
All 5 steps shown.
You
AIassistant
TypeScript
Node
You: ask for the lineaskforthelineaskfortheline
AI assistant: "=" * 28"="*28"="*28
TypeScript: TS2362TS2362TS2362
You: look up on MDNlookuponMDNlookuponMDN
TypeScript: checked ✓checked✓checked✓
Node: the bannerthebannerthebanner
Time
You ask how to print 28 equals signs without typing them.
It answers at once, sure of itself: const line = "=" * 28;.
The left-hand side of an arithmetic operation must be…: text
cannot be multiplied.
You search MDN for repeating a string and find repeat().
With "=".repeat(28) the check prints nothing.
You run node index.ts, and both lines print 28 equals signs.
An assistant's answer is a suggestion until the check passes
All 6 steps shown.Step 1 of 6: You: ask for the lineStep 2 of 6: AI assistant: "=" * 28Step 3 of 6: TypeScript: TS2362Step 4 of 6: You: look up on MDNStep 5 of 6: TypeScript: checked ✓Step 6 of 6: Node: the banner
All 6 steps shown.
Pasted and run, the answer fails without a word. Node prints NaN
where each line of equals signs should be: text that is not a
number, like "=", times a number gives no number, and JavaScript
carries on with this odd value instead of stopping. You will meet
NaN properly in the next module.
Checked first, the same answer is stopped before anything runs:
Outputtext
index.ts:2:14 - error TS2362: The left-hand side of anarithmetic operation must be of type 'any', 'number','bigint' or an enum type.2 const line = "=" * 28; ~~~Found 1 error in index.ts:2
The message's first line is one line in your terminal, broken in
three here. You do not need to know
what bigint or an enum is to read it: the left-hand side of the
*, the text "=", is not a number. That is your cue to look
the job up on MDN, where repeat() is waiting. So before you keep
any answer, an assistant's, a forum's or a blog's, do three
things:
Check it: npx tsc --noEmit index.ts prints nothing.
Run it: node index.ts prints what you expected, line by line.
Look up every name in it you do not know, on MDN or in the
docs it belongs to.
Predict before you run
You have read the Return value of repeat(): a new string made of
the copies, joined together. Use it.
Predict
What does this program print?
ts
const line = "-=".repeat(3);console.log(line);
The common mistake: an answer for the browser
JavaScript runs in two very different places: in a web browser,
and in Node. Most of what MDN describes works in both, but not
all of it, and answers you find, an assistant's included, often
come from code written for a browser.
Common mistake
Running code written for a web browser in Node
You want TaskKit to ask for the name of a task, and an assistant
suggests adding two lines under the banner:
npx tsc --noEmit index.ts prints nothing, so you run it. The
banner prints, and then:
Output (the first lines after the banner)text
/Users/ana/projects/taskkit/index.ts:7const task = prompt("Task name?"); ^ReferenceError: prompt is not defined
C:\Users\ana\projects\taskkit\index.ts:7const task = prompt("Task name?"); ^ReferenceError: prompt is not defined
/home/ana/projects/taskkit/index.ts:7const task = prompt("Task name?"); ^ReferenceError: prompt is not defined
prompt is real JavaScript, in a web browser: it opens a small
box that asks a question. TypeScript, set up as you have it, knows
everything a browser provides, so its check found nothing wrong.
Node is not a browser, and it has no prompt.
ReferenceError: prompt is not defined
The fix
Look every unfamiliar name up before you keep it. On MDN this one is
called Window: prompt() method, filed under Web APIs (application
programming interfaces: the tools a browser gives a program): it
belongs to the browser's window. Its Browser compatibility table has
no Node.js column at all, where the table on the repeat() page has
one. Until TaskKit learns to read input, in the next module, write
the task name into the code:
When Node says a name from an answer is not defined, and TypeScript
said nothing, suspect the browser. On MDN, a title that starts with
Window: or Document: is a browser feature, and the Node.js
column of the compatibility table settles it. console is filed
under Web APIs too, and works in Node: the column, not the section,
decides.
Pass all four tasks to complete the lesson with practice. Reach the end without them and it counts as read only.
Exercises
These run in your browser. Two ask you to read, two to put what you
looked up to work; try the code ones in your own taskkit too.
Exercise · Read the code
Find the part of the page that answers
TypeScript refuses "=".repeat("28") with Argument of type 'string' is not assignable to parameter of type 'number'. Which
part of MDN's page for repeat() tells you what repeat()
expects in its brackets?
Exercise · Fix the error
Give repeat a number
TypeScript refuses this banner with
Expected 1 arguments, but got 0. Fix it so the check is clean and
the banner prints its four lines, with 28 equals signs in the first
and the last.
Loading the editor…
Exercise · Write the code
Draw the task list's divider
Under its banner, TaskKit will list your tasks below a heading
and a thinner line. Make a box called divider that holds 28
dashes, -, made with repeat(), then print Tasks and the
divider under it.
text
Tasks----------------------------
Loading the editor…
Exercise · Read the code
Ask so the answer is about your code
You use TypeScript 7 and Node 24, and npx tsc --noEmit refuses
const line = "=".repeat("28"); with TS2345. Which message to an
assistant gets an answer about your own code?
Recap
Recap · 3 questions
Check yourself
Where do you first look up a JavaScript built-in?
Check yourself
What do you type into a search for an error?
Check yourself
An assistant's code looks right. What do you do first?
0 of 0 answered.
A cheat sheet to keep
Cheat sheet
Where to find answers: docs, MDN, and AI
What things are
Word
What it means
Documentation
The official description of a language or tool
Reference page
One per built-in: syntax, parameters, examples
MDN
developer.mozilla.org: JavaScript and the web
TypeScript docs
typescriptlang.org/docs: types and tsc
Node.js docs
nodejs.org/docs: node itself, one per version
String
A piece of text, such as "="
Type
The kind of a value: string is text, number a number
Parameter
A value a built-in expects in its brackets
Argument
The value you put there
AI assistant
A chat program that writes answers; can be wrong
Where to look
Ask
Look in
How do I do this?
MDN, for JavaScript
What does TypeScript want?
The error, then the TypeScript docs
What does node do?
Node.js docs for your version
Does Node have it?
MDN's table: a Node.js column
Code
Write
To
"=".repeat(28)
Make 28 copies of =, joined into one
Before you keep an answer
Rule
What it means
Name the site
mdn string repeat, not just string repeat
Search the sentence
The error's code and words, not your names
Give the whole picture
Versions, the line, the message, the goal
Check it
npx tsc --noEmit prints nothing
Run it
node prints what you expected
Look it up
Every name you do not know, in the docs
No secrets
Never paste passwords or keys into a chat
Module 1 on one page
Cheat sheet
Module 1: Getting Started
What a program is and how a computer runs it
Word
What it means
Program
Instructions precise enough to need no guessing
Top to bottom
One line finishes before the next starts
Boxes first
Make a box above the line that uses it
Quotes matter
"Groceries" is text; Groceries is a box's name
Your setup: VS Code, Node.js, and basic terminal commands
Write
To
pwd
Print the folder you are in
cd projects
Move into a folder inside this one
cd ..
Move out to the folder that holds this one
mkdir taskkit
Make a new folder here
code .
Open this folder in VS Code
Hello, world: running your first .ts file
Rule
What it means
Save, then run
Node runs the file as it is on the disk
Stand in its folder
Node looks for the file where the terminal is
Try, then keep
Playground for a quick try; a file for the project
Two tools, two jobs: Node runs your code, TypeScript checks it
Step
Command
Install, once
npm install --save-dev typescript
Check
npx tsc --noEmit index.ts, silent when clean
Run
node index.ts
Your first error message: how to read it without panic
Rule
What it means
index.ts:3:24
The file, line 3, column 24
Error code
TS2552: the number of a kind of TypeScript error
First error first
Later errors often come from the first one
Read upward
If the named line is fine, read the one above
Where to find answers: docs, MDN, and AI assistants used wisely
Rule
What it means
MDN
How to do it in JavaScript
Search the sentence
The error's code and words, not your names
Check every answer
Check it, run it, look its names up
Where to go next
You can now tell which of three places answers a question, read
a reference page from its title to its compatibility table, turn
an error into a search that finds it, and ask an AI assistant in
a way that gets an answer about your own code. Above all, you
check every answer before you keep it. That closes Module 1: you
can write a file, check it, run it, read what goes wrong, and
find out what you do not know.
Next is const and let, the first lesson of Module 2. It
opens up the boxes you have been filling since the first lesson:
which ones are locked once filled, which can be filled again, and
why TypeScript cares about the difference.
Before you move on, look one more thing up yourself. Find MDN's
page for toUpperCase(), read its first sentence, its Examples
and the Node.js column of its table, then make the banner print
TASKKIT 0.1. Check it and run it before you call it done.