cool-easter-32542
07/11/2025, 4:43 AMtsconfig.json / jsconfig.json specifies options for TypeScript and IDEs, per tsconfig.py, and can be layered via extends referring to 'parent' configurations
pants/src/python/pants/backend/typescript/tsconfig.py
Lines 3 to 8 in</pantsbuild/pants/commit/9e9a8c2ed47a7af2754e837f4aefd6b085b832d5|9e9a8c2>
| """tsconfig.json is primarily used by the typescript compiler in order to resolve types during |
| ---------------------------------------------------------------------------------------------- |
| compilation. The format is also used by IDE:s to provide intellisense. The format is used for |
| projects that use only javascript, and is then named jsconfig.json. |
| |
| See https://code.visualstudio.com/docs/languages/jsconfig |
| """ |
For instance, these tsconfig.json and package.json files:
{
"extends": "@tsconfig/node20/tsconfig.json"
}
{
...,
"dependencies": {
"@tsconfig/node20": "^20.1.4",
}
}
However, Pants fails to understand this, resulting in a warning:
14:35:00.38 [WARN] pants could not locate tsconfig.json's 'extends' at @tsconfig/node20/tsconfig.json. Found: ['tsconfig.json'].
Reproducer:
cd $(mktemp -d)
cat > pants.toml <<EOF
[GLOBAL]
pants_version = "2.29.0.dev0"
backend_packages = [
"pants.backend.experimental.javascript",
"pants.backend.experimental.typescript",
]
EOF
cat > BUILD <<EOF
package_json(name="pkg")
typescript_sources(name="ts")
EOF
touch main.ts
cat > tsconfig.json <<EOF
{
"extends": "@tsconfig/node20/tsconfig.json"
}
EOF
cat > package.json <<EOF
{
"name": "example",
"version": "1.0.0",
"main": "index.js",
"scripts": {},
"author": "",
"description": "",
"dependencies": {
"@tsconfig/node20": "^20.1.6"
}
}
EOF
cat > package-lock.json <<EOF
{
"name": "example",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "example",
"version": "1.0.0",
"dependencies": {
"@tsconfig/node20": "^20.1.6"
}
},
"node_modules/@tsconfig/node20": {
"version": "20.1.6",
"resolved": "https://registry.npmjs.org/@tsconfig/node20/-/node20-20.1.6.tgz",
"integrity": "sha512-sz+Hqx9zwZDpZIV871WSbUzSqNIsXzghZydypnfgzPKLltVJfkINfUeTct31n/tTSa9ZE1ZOfKdRre1uHHquYQ=="
}
}
}
EOF
# BUG: "[WARN] pants could not locate tsconfig.json's 'extends' at @tsconfig/node20/tsconfig.json. Found: ['tsconfig.json']."
pants dependencies main.ts
# Baseline: tsc itself is happy
# npm install
# tsc -p ./tsconfig.json
Pants version
2.29.0.dev0
OS
macOS
Additional info
N/A
pantsbuild/pants