microsoft / microsoft/TypeScript
TS 5.6 requires composite projects with noEmit to have fully accessible types, unlike 5.5
@sheetalkamat ci sta già lavorando.
Dal 13/9/2024.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔎 Search Terms
TS2742, TS7056, TS9006, TS4058, TS4023, noEmit, composite, 5.6
🕗 Version & Regression Information
- This changed between versions 5.5.4 and 5.6.2
⏯ Playground Link
https://github.com/Ambroos/ts-56-composite-project-noemit
💻 Code
file: Internal.ts
interface Internal {
a: boolean,
}
export default function somethingInternal() {
return {
one: { a: true } as Internal,
};
}
file: index.ts
import createInternal from "./Internal";
export const one = createInternal().one;
file: tsconfig.json
{
"compilerOptions": {
"composite": true,
"noEmit": true,
"strict": true,
},
"include": [
"*.ts"
]
}
🙁 Actual behavior
In TS 5.6.2, run tsc and get error:
index.ts:3:14 - error TS4023: Exported variable 'one' has or is using name 'Internal' from external module "/Users/ambroos/Dev/ts-composite-5.6/Internal" but cannot be named.
3 export const one = createInternal().one;
This is the error in the sample project linked above (or created with the files from the code part). In our actual repo a large amount of new errors appeared that are related: TS2742, TS7056, TS9006, TS4058, TS4023.
🙂 Expected behavior
No errors, like 5.5.4 and older.
Additional information about the issue
This only happens in composite projects, even when not using --build. We have a large composite project, but the oldest parts of our code live in projects that don't emit since no-one is allowed to depend on them (they're apps that get built as-is).
In the past, when not emitting type declarations, it was OK to reference types that cannot be named, even in incremental compilation / composite projects. Now however it looks like because .tsbuildinfo is always generated, making code able to be emitted seems to have become required.
Maybe this is intentional, but it would be nice to still have some escape hatch for these types of composite project parts that don't actually need to emit declarations, they just need to be checked and transpiled.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.