GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — `tsc -b`: incremental build keeps a declaration that names a removed re-export, and passes a program a clean build rejects · Issue #64591 · microsoft/TypeScript Open Description🔎 Search Termstsc -b incremental stale declaration, stale d.ts, re-export removed, declaration emit module specifier, getAlternativeContainingModules, build mode false negative, tsbuildinfo 🕗 Version & Regression Information
Tried: 6.0.3, 7.0.2, 7.1.0-dev.20261002.1. ⏯ Playground LinkNo response (needs 💻 CodeA composite project // lib/src/deep/tags.ts export interface CommonErrors { readonly tag: "common"; } // lib/src/deep/boundary.ts import type { CommonErrors } from "./tags"; export const boundary = <T>(value: T): T & { readonly middleware: CommonErrors } => ({ ...value, middleware: { tag: "common" }, }); // lib/src/server.ts export type { CommonErrors } from "./deep/tags"; // lib/src/feed/api.ts (imports deep/boundary only) import { boundary } from "../deep/boundary"; export const feed = boundary({ name: "feed" }); // app/src/index.ts (skipLibCheck; must not compile: tag is a string) import { feed } from "../../lib/src/feed/api"; export const wrong: number = feed.middleware.tag; Steps:
Script that writes the project in a temporary directory and runs the three steps (argument: the tsc command)#!/bin/sh # usage: sh repro-3-stale-declaration.sh [tsc command] set -u tsc=${1:-tsc} cd "$(mktemp -d)" || exit 1 # The physical path: on macOS the temporary directory is behind a symbolic link. cd "$(pwd -P)" || exit 1 mkdir -p lib/src/deep lib/src/feed app/src cat >lib/tsconfig.json <<'JSON' { "compilerOptions": { "composite": true, "emitDeclarationOnly": true, "module": "esnext", "moduleResolution": "bundler", "strict": true, "rootDir": "src", "outDir": "out" }, "include": ["src"] } JSON cat >lib/src/deep/tags.ts <<'TS' export interface CommonErrors { readonly tag: "common"; } TS cat >lib/src/deep/boundary.ts <<'TS' import type { CommonErrors } from "./tags"; export const boundary = <T>(value: T): T & { readonly middleware: CommonErrors } => ({ ...value, middleware: { tag: "common" }, }); TS cat >lib/src/feed/api.ts <<'TS' import { boundary } from "../deep/boundary"; export const feed = boundary({ name: "feed" }); TS echo 'export type { CommonErrors } from "./deep/tags";' >lib/src/server.ts cat >app/tsconfig.json <<'JSON' { "compilerOptions": { "noEmit": true, "module": "esnext", "moduleResolution": "bundler", "strict": true, "skipLibCheck": true }, "include": ["src"], "references": [{ "path": "../lib" }] } JSON cat >app/src/index.ts <<'TS' import { feed } from "../../lib/src/feed/api"; export const wrong: number = feed.middleware.tag; TS named() { grep -o 'import("[^"]*")[A-Za-z.]*' lib/out/feed/api.d.ts; } echo "app assigns a string to a number, so every build must fail." echo "1. clean build" $tsc -b app echo " exit code: $? feed/api.d.ts names: $(named)" sleep 1 echo 'export {};' >lib/src/server.ts echo "2. server.ts no longer exports CommonErrors; incremental build" $tsc -b app echo " exit code: $? feed/api.d.ts names: $(named)" rm -rf lib/out lib/tsconfig.tsbuildinfo app/tsconfig.tsbuildinfo echo "3. the same source; clean build" $tsc -b app echo " exit code: $? feed/api.d.ts names: $(named)" 🙁 Actual behaviorStep 2 passes a program that step 3, with the same source, rejects. The declaration of 🙂 Expected behaviorStep 2 fails like step 3: Additional information about the issue
ActivityMetadataMetadataAssigneesLabelsBugA bug in TypeScript TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |