<#22471 typescript: imports from a .d.ts declarati...
# github-notifications
c
#22471 typescript: imports from a .d.ts declaration file are not inferred Issue created by huonw Describe the bug Typescript supports so-called 'declaration files' (https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html), like
foo.d.ts
, that contain just type declarations, similar to
.pyi
in Python. One can import from them like normal, e.g.
import { SomeType } from './foo';
. Pants doesn't currently infer these. Reproducer, using this typescript file: import { SomeType } from './declaration'; const f = (x: SomeType) => {}; 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 echo 'typescript_sources(name="ts")' > BUILD echo 'export interface SomeType {}' > declaration.d.ts cat > main.ts <<EOF import { SomeType } from './declaration'; const f = (x: SomeType) => {}; EOF # BUG: "Pants cannot infer owners for the following imports in the target //main.tsts ... ./declaration" pants dependencies main.ts # Baseline:
tsc main.ts
runs successfully Pants version 2.29.0.dev0 OS macOS Additional info N/A pantsbuild/pants