🔎 Search Terms
Typescript version: 5.1.6
I don't get any error even though I use 'port' variable reference in index.ts file without importing it from constants.ts file, even though I didn't use the export keyword when declaring it.
🕗 Version & Regression Information
- This is a crash
- This changed between versions ______ and _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______
⏯ Playground Link
No response
💻 Code
constants.ts
const port = 8000
index.ts
import express from 'express'
const app = express()
app.listen(port, ()=>{
})
tsconfig.json
{
"compilerOptions": {
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"module": "commonjs", /* Specify what module code is generated. */
"rootDir": "./src", /* Specify the root folder within your source files. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"strict": true, /* Enable all strict type-checking options. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}
🙁 Actual behavior
not detecting any error.
tsc build ok. but it's getting a referenceError when running.
🙂 Expected behavior
It should give me an error where I use 'port' variable in index.ts file.
Is it a Typescript bug or am I missing some options in tsconfig file?
🔎 Search Terms
Typescript version: 5.1.6
I don't get any error even though I use 'port' variable reference in index.ts file without importing it from constants.ts file, even though I didn't use the export keyword when declaring it.
🕗 Version & Regression Information
⏯ Playground Link
No response
💻 Code
constants.ts
const port = 8000index.ts
tsconfig.json
🙁 Actual behavior
not detecting any error.
tsc build ok. but it's getting a referenceError when running.
🙂 Expected behavior
It should give me an error where I use 'port' variable in index.ts file.
Is it a Typescript bug or am I missing some options in tsconfig file?