Autocomplete not working in Vscode
macario1983 opened this issue · 2 comments
I created new project using the commands linke
npm init -y
And generate new binary
xk6 build --with github.com/mostafa/xk6-kafka@latest
The program is running ok, but I tried to follow the step 9 in the documentation but not working.
My folder structure is
And my code is:
/// <reference path="..//api-docs//index.d.ts" />
import {
Writer,
Connection,
SchemaRegistry,
SCHEMA_TYPE_STRING
} from "k6/x/kafka";
const writer = new Writer({
brokers: ["localhost:19092"],
topic: "my-topic",
autoCreateTopic: true,
});
const connection = new Connection({
address: "localhost:19092",
});
const schemaRegistry = new SchemaRegistry();
export default function () {
writer.produce({
messages: [
{
key: schemaRegistry.serialize({
data: "test-key-string",
schemaType: SCHEMA_TYPE_STRING,
}),
value: schemaRegistry.serialize({
data: "test-value-string",
schemaType: SCHEMA_TYPE_STRING,
}),
headers: {
mykey: "myvalue",
},
partition: 0,
time: new Date(),
}
],
});
}
export function teardown(data) {
writer.close();
connection.close();
}
Hey @macario1983,
You probably don't need the entire source code of xk6-kafka to work with it and write scripts, and you can use the binaries distributed here. Also, I recommend copying the index.d.ts
file next to your JavaScript code, and referencing it from the current working directory.
@mostafa thanks for your reply, before to post, I also tryed to put the index.d.ts
in the same level of the mas test file, but not worked.
I think if you could publish one example in github will help to know whats wrong.