Coder Social home page Coder Social logo

Comments (2)

YoEight avatar YoEight commented on September 21, 2024

I fail to see your point. Those files aren't publicly exposed to the user.

from eventstore-client-nodejs.

LucasPaganini avatar LucasPaganini commented on September 21, 2024

The types are exposed. You can't compile your typescript code if it uses this package without having @types/google-protobuf installed.

mkdir test
cd test 
npm init -y
npm i @eventstore/db-client
npm i -D typescript

tsconfig.json

{
  "compilerOptions": {
    "alwaysStrict": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "strictNullChecks": true,
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": true,
    "declaration": true,
    "target": "es2018",
    "lib": ["es2020"],
    "baseUrl": ".",
    "outDir": "dist",
    "allowJs": false,
    "types": ["node"]
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "src/**/*.spec.ts"]
}

src/main.ts

import { EventStoreDBClient } from "@eventstore/db-client";

const EVENTS_HOST = "localhost:2113";
const EVENTS_STREAM = "app-events";

(async () => {
  const eventStoreClient = new EventStoreDBClient(
    { endpoint: EVENTS_HOST },
    { insecure: true }
  );

  const sub = eventStoreClient.subscribeToStream(EVENTS_STREAM);
  sub.on("data", (resolvedEvent) => {
    console.log("Event", resolvedEvent);
  });
})();

Can't compile

Try npx tsc, you'll see 6 erros because the package is exporting types from @types/google-protobuf that are not present in the dependencies.

Now npm i -D @types/google-protobuf and try to compile npx tsc. Now it works.

from eventstore-client-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.