It seems I am unable to access/reuse ts interfaces...
# general
i
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
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
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