There seems to be a type mismatch in the New Relic...
# general
a
There seems to be a type mismatch in the New Relic provider for typescript. Given this code (from the documentation) :
Copy code
const foo = new newrelic.cloud.GcpLinkAccount("foo", {projectId: "<Your GCP project ID>"});
const foo1 = new newrelic.cloud.GcpIntegrations("foo1", {
    linkedAccountId: foo.id,
linkedAccountId
is expecting a number and
foo.id
from the linked account is a string. Either the documentation is wrong (or I am miss reading it), or the type implementation is wrong? Any help? Thanks. I will also issue a support ticket on this and will add its reference in a thread. Thanks!
Request# 4991
w
Hi @adorable-activity-71456 We can work the issue here in slack and I’ll update the ticket as needed. Have you tried the code as written and it’s mad about the type mismtach?
a
Typescript is erroring with:
Copy code
Type 'Output<string>' is not assignable to type 'Input<number>'.
  Type 'Output<string>' is not assignable to type 'OutputInstance<number>'.
That’s the first two lines.
Output<string> being
foo.id
and Input<number> being
linkedAccountId
full error:
Copy code
src/new-relic.ts:43:5 - error TS2322: Type 'Output<string>' is not assignable to type 'Input<number>'.
  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'.

43     linkedAccountId: foo.id,
       ~~~~~~~~~~~~~~~

  ../../node_modules/@pulumi/newrelic/cloud/gcpIntegrations.d.ts:443:5
    443     linkedAccountId: pulumi.Input<number>;
            ~~~~~~~~~~~~~~~
    The expected type comes from property 'linkedAccountId' which is declared here on type 'GcpIntegrationsArgs'


Found 1 error in src/new-relic.ts:43
w
Do you know if
foo.id
is a stringified number? Or is it alphanumeric? If it is a number, a quick fix that should work would be:
linkedAccountid: foo.id.apply(id => parseInt(id))
a
That does fix it, thanks! I am unblocked for now. But it’s strange that those two things are different types, and the documentation is not accurate.
w
Agreed. I’ll open a ticket against the provider to either fix the example or see if the SDK can change to accept linkedAccountId as a string.
a
Maybe have the output of gcp linked account id be a number.
w
or that 🙂
a
hehe
Thanks
w