https://pulumi.com logo
#general
Title
# general
i

important-leather-28796

04/11/2019, 9:21 PM
It seems I am unable to access/reuse ts interfaces from the generated packages, e.g. pulumi-kubernetes - I want to declare and reuse an affinity but
types/input
is not accessible. e.g.
input.core.v1.Affinity
b

big-piano-35669

04/11/2019, 9:36 PM
Did you try importing it directly? This should work:
Copy code
import * as k8sinput from "@pulumi/kubernetes/types/input";
...
const affinity: k8sinput.core.v1.Affinity = ...;
I just tried this and it worked. I'll admit, I'm not sure why
types
isn't exported as a submodule and have always found it a little odd -- @creamy-potato-29402 or @gorgeous-egg-16927, was this intentional? That'd let you write
Copy code
import * as k8s from "@pulumi/kubernetes";
...
const affinity: k8s.types.input.core.v1.Affinity = ...;
Easy to find when plonking around in your editor.
i

important-leather-28796

04/11/2019, 9:37 PM
I didn’t - browser habit to avoid cjs/esm bundle bloat conflicts but indeed that might work here without any side effects
direct file import worked
👍 1