> webpack
assets by status 8.71 KiB [cached] 1 asset
orphan modules 10.8 KiB [orphan] 6 modules
runtime modules 937 bytes 4 modules
./src/my-project.test.ts + 6 modules 15.7 KiB [not cacheable] [built] [code generated]
ERROR in /Users/mjourard/git_repos/my-project/k6/src/my-project.test.ts
9:16-26
[tsl] ERROR in /Users/mjourard/git_repos/my-project/src/my-project.test.ts(9,17)
TS2307: Cannot find module 'k6/x/sql' or its corresponding type declarations.
ts-loader-default_e3b0c44298fc1c14
webpack 5.68.0 compiled with 1 error in 7787 ms
I noticed there is no entry in the DefinitelyTyped repo, and no types folder in the repo of the extension. Is this feature not supported when using extensions?
I found that I was able to transpile with webpack the examples from the xk6-sql repo just fine. It failed to transpile when I removed k6 from the externals, which just about confirms it.
Thanks again, this will let me continue forward with our testing project.
As an aside, any chance you’ve got some magic to get intellisense working with the xk6 libraries in typescript?
Edit: after further digging, I also determined that using the babel transpiler was required, moving away from ts-loader. Not sure what it was about babel but it had something that the ts-loader did not.
As an aside, any chance you’ve got some magic to get intellisense working with the xk6 libraries in typescript?
As an extension to the answer from the community call, I guess it’s possible for type definitions to be extracted from an extension. But no such work has been done. I also am not familiar with how that will then need to be integrated with intellisense to make it work and whether that will be easily doable.
A k6 LSP kind of project might work better I guess, but I have no idea what that will entail as well.
You should probably try to open a feature request and hopefully someone with more knowledge on this front will be able to weight in.
I don’t expect to have Typescript definitions for all the extensions, but more mature extensions might have. I suggest providing one for xk6-browser as requested here.
@mjourard, double-checking: did you get working the SQL extension with Typescript using the provided template?