grafana / xk6-faker

Random fake data generator for k6.
https://faker.x.k6.io
GNU Affero General Public License v3.0
59 stars 18 forks source link

Type definition partially not working with xk-ts due to number type collision #20

Closed lvogt closed 2 months ago

lvogt commented 3 months ago

When using the type definition provided here together with xk6-ts (maybe also when using webpack or another bundler?) you cannot use the faker.number generator as the type clashes with the built-in Typescript number type.

export declare class Faker {
  [...]
  readonly number: number;
  [...]
}

[...]

export declare interface Number {
  [...]
}

This can easily be fixed "in-place" by renaming the the interface to something else (for example Numbers).

If I understood that correctly the index.d.ts is generated by some go code, but I lack any go experience to adjust the codegen.

If adjusting the index.d.ts directly is fine, I am happy to create a PR (but probably only after my two week long vacation)

szkiba commented 3 months ago

Hi @lvogt

Thanks for reporting it. I think the situation is similar with the "String" type. I will investigate and fix it soon.