-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ErrorOptions is not defined in errors.ts #177
Comments
This is a built-in type on es2022, perhaps bump your typescript version to something like:
|
We are using es2022 and the error still occurs. It is not possible in our use case to use esnext as we are using this package in an Angular application. |
what is your angular version |
Thanks for reopening the issue. We are running Angular 18. |
works for me on 19. |
Note quite sure what you are doing, but verified it works on 18/19. modified generated app.component.ts (ng new ...) import { Component } from "@angular/core";
import { RouterOutlet } from "@angular/router";
import { nuid, wsconnect, nanos } from "@nats-io/nats-core";
import { jetstreamManager, AckPolicy, jetstream } from "@nats-io/jetstream";
@Component({
selector: "app-root",
standalone: true,
imports: [RouterOutlet],
templateUrl: "./app.component.html",
styleUrl: "./app.component.css",
})
export class AppComponent {
title = "ang-18";
ngOnInit() {
(async () => {
const nc = await wsconnect({ servers: "demo.nats.io:8443" });
console.log("connected to", nc.getServer());
const subj = nuid.next();
const sub = nc.subscribe(`${subj}.*`, {
callback: (_, msg) => {
console.log(`sub: ${msg.subject}`);
},
});
let counter = 0;
setInterval(() => {
nc.publish(`${subj}.${counter++}`);
}, 500);
const jsm = await jetstreamManager(nc);
await jsm.streams.add({
name: subj,
subjects: [`${subj}.*`],
max_age: nanos(5_000),
max_msgs: 20
});
const ci = await jsm.consumers.add(subj, {
ack_policy: AckPolicy.Explicit,
});
const js = jetstream(nc);
const c = js.consumers.getConsumerFromInfo(ci);
const iter = await c.consume();
for await(const m of iter) {
console.log(m.seq, m.subject);
}
})();
}
} /p/t/ang-18 (main) [SIGINT]> npm ls
[email protected] /private/tmp/ang-18
├── @angular-devkit/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @nats-io/[email protected]
├── @nats-io/[email protected]
├── @types/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
|
Feel free to re-open, but simple example works for me. |
One thing that comes to mind is that possibly you are using the jsr libs, so you are effectively re-building the library - just use the node library ( |
Observed behavior
ErrorOptions is not defined in errors.ts and package is unusable.
Expected behavior
ErrorOptions is defined in errors.ts and package is usable.
Server and client version
@nats-io/nats-core: "3.0.0-48"
Host environment
No response
Steps to reproduce
No response
The text was updated successfully, but these errors were encountered: