#red underlines

1 messages · Page 1 of 1 (latest)

flint crypt
#

I just started to learn TypeScript. After I tried some basic stuff, I used "tsc intro.ts" command to generate a js file. But now I see my variable names have red underlines because generated js file has same variables. Is this a problem or did I misunderstand the purpose of TypeScript?

woeful pecan
#

@flint crypt That can be an issue; I think mostly if the code doesn't include imports/exports (which makes it global).

#

Generally the normal approach is to setup the project with an outDir, something like "dist", which avoids having the TS and JS files mixed together.

#

Also:

#

!*:no-tsc-args

north socketBOT
#
retsam19#0
`!retsam19:no-tsc-args`:

You should always run tsc without arguments: e.g. npx tsc not npx tsc src/index.ts. Running it with arguments will ignore your tsconfig file.

Instead of passing files to tsc, the include/exclude/files settings inside your tsconfig are used to control what is copied.

flint crypt
#

It was really underwhelming at first I see TypeScript like that. Thank you so much!