Skip to content

input/output mismatch for nodejs ObjectMeta #158

@blampe

Description

@blampe

What happened?

Node SDKs generate metadata inputs which need to be wrapped with pulumi.output in order to be consumed downstream.

Without pulumi.output the user will see

Type 'Output<Input<string>>' is not assignable to type 'Input<string>'.
  Type 'OutputInstance<Input<string>> & LiftedObject<String,
NonFunctionPropertyNames<String>>' is not assignable to type 'Input<string>'.
    Type 'OutputInstance<Input<string>> & LiftedObject<String,
NonFunctionPropertyNames<String>>' is not assignable to type
'OutputInstance<string>'.
      Types of property 'apply' are incompatible.
        Type '{ <U>(func: (t: Input<string>) => Promise<U>): Output<U>;
<U>(func: (t: Input<string>) => OutputInstance<U>): Output<U>; <U>(func: (t:
Input<...>) => U): Output<...>; }' is not assignable to type '{ <U>(func: (t:
string) => Promise<U>): Output<U>; <U>(func: (t: string) =>
OutputInstance<U>): Output<U>; <U>(func: (t: string) => U): Output<...>; }'.
          Types of parameters 'func' and 'func' are incompatible.
            Types of parameters 't' and 't' are incompatible.
              Type 'Input<string>' is not assignable to type 'string'.
                Type 'Promise<string>' is not assignable to type 'string'.
(tsserver 2322)

Refs #157

Example

import * as cm from "./crds/nodejs/cert_manager";
import * as pulumi from "@pulumi/pulumi";

const parent = new cm.v1.Certificate("parent", {});

new cm.v1.Certificate("child", {
  metadata: {
    name: parent.metadata.name,                          // Type is not assignable
    namespace: pulumi.output(parent.metadata.namespace), // OK
  },
  spec: { secretName: parent.spec.secretName },

Output of pulumi about

n/a

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Metadata

Metadata

Assignees

Labels

impact/usabilitySomething that impacts users' ability to use the product easily and intuitivelykind/bugSome behavior is incorrect or out of specresolution/fixedThis issue was fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions