You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any pointers on how to use the earthstar npm package in a node-typescript project? This is how far I got:
mkdir test
cd test
npm install earthstar
cat << EOF > test.ts
import {
ExtensionKnownShares,
ExtensionSyncWeb,
Replica,
ReplicaDriverFs,
Server,
} from "earthstar";
import { createServer } from "http";
const nodeServer = createServer();
const server = new Server([
new ExtensionKnownShares({
// known_shares.json contains a JSON array of public share addresses.
knownSharesPath: "./known_shares.json",
// Persist share data to disk with ReplicaDriverFs
onCreateReplica: (shareAddress) => {
return new Earthstar.Replica({
driver: new ReplicaDriverFs(shareAddress, "./share_data"),
});
},
}),
new ExtensionSyncWeb({ server: nodeServer }),
], { server: nodeServer });
EOF
tsc test.ts
Expected: compilation success
Actual:
../node_modules/@deno/sham-weakref/dist/index.d.ts:2:14 - error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
2 readonly [Symbol.toStringTag]: "WeakRef";
~~~~~~~~~~~~~~~~~~~~
../node_modules/@deno/sham-weakref/dist/index.d.ts:2:15 - error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
2 readonly [Symbol.toStringTag]: "WeakRef";
~~~~~~
../node_modules/@sgwilym/isomorphic-streams/index.d.ts:2:3 - error TS1165: A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type.
2 [Symbol.asyncIterator](): AsyncIterator<R>;
~~~~~~~~~~~~~~~~~~~~~~
../node_modules/@sgwilym/isomorphic-streams/index.d.ts:2:4 - error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
2 [Symbol.asyncIterator](): AsyncIterator<R>;
~~~~~~
../node_modules/@sgwilym/isomorphic-streams/index.d.ts:2:29 - error TS2583: Cannot find name 'AsyncIterator'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
[...]
This is with Version 5.4.5 of tsc.
The text was updated successfully, but these errors were encountered:
Any pointers on how to use the earthstar npm package in a node-typescript project? This is how far I got:
Expected: compilation success
Actual:
This is with Version 5.4.5 of tsc.
The text was updated successfully, but these errors were encountered: