Skip to content

Instance stackscriptId type error #281

@jchook

Description

@jchook

What happened?

Type 'Output<string>' is not assignable to type 'number | Promise<number> | OutputInstance<number> | undefined'.
  Type 'Output<string>' is not assignable to type 'OutputInstance<number>'.
    Types of property 'apply' are incompatible.
      Type '{ <U>(func: (t: string) => Promise<U>): Output<U>; <U>(func: (t: string) => OutputInstance<U>): Output<U>; <U>(func: (t: string) => U): Output<...>; }' is not assignable to type '{ <U>(func: (t: number) => Promise<U>): Output<U>; <U>(func: (t: number) => OutputInstance<U>): Output<U>; <U>(func: (t: number) => U): Output<...>; }'.
        Types of parameters 'func' and 'func' are incompatible.
          Types of parameters 't' and 't' are incompatible.
            Type 'string' is not assignable to type 'number'. (tsserver 2322)

Expected Behavior

No type error.

Steps to reproduce

import * as linode from "@pulumi/linode";

export const appStackScript = new linode.StackScript("appStackScript", {
  description: "My App StackScript",
  label: "appStackScript",
  images: ["linode/debian11"],
  isPublic: false,
  script: '# ...',
});

export const app1 = new linode.Instance("app1", {
  image: "linode/debian11",
  label: "app1",
  region: "us-east",
  type: "g6-nanode-1",
  stackscriptId: appStackScript.id, // Type error here
});

Output of pulumi about

CLI          
Version      3.46.1-dev.0
Go Version   go1.19.2
Go Compiler  gc

Plugins
NAME    VERSION
linode  3.12.0
nodejs  unknown

Host     
OS       void
Version  
Arch     x86_64

This project is written in nodejs: executable='/home/jchook/.local/opt/n/bin/node' version='v16.19.1'

Current Stack: dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/jchook
User           jchook
Organizations  jchook

Dependencies:
NAME            VERSION
@types/node     16.18.31
@pulumi/linode  3.12.0
@pulumi/pulumi  3.68.0

Pulumi locates its logs in /tmp by default

Additional context

I would like to create a StackScript and then apply it to an instance.

I don't fully understand technical details of the issue, but this seems like a bug to me.

Potential workaround:

export const app1 = new linode.Instance("app1", {
  // ...
  stackscriptId: appStackScript.id.apply(id => parseInt(id)),
}

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

No one assigned

    Labels

    kind/bugSome behavior is incorrect or out of spec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions