Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

fix: update ts examples #219

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/circuit-relaying/src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module.exports = (ipfs, peersSet) => {

for (let k = 0; k < 5; k++) {
// protocols is undefined until the connection is negotiated so try a few times
const protocols = ipfs.libp2p.peerStore.protoBook.get(con.remotePeer)
const protocols = await ipfs.libp2p.peerStore.protoBook.get(con.remotePeer)

if (!protocols) {
await new Promise ((r) => {
Expand Down
3 changes: 1 addition & 2 deletions examples/types-use-ipfs-from-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"test": "tsc --noEmit"
},
"dependencies": {
"ipfs-core": "^0.12.2",
"multiformats": "^9.4.1"
"ipfs-core": "^0.12.2"
},
"devDependencies": {
"typescript": "4.3.5"
Expand Down
2 changes: 1 addition & 1 deletion examples/types-use-ipfs-from-ts/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IPFS, create } from 'ipfs-core'
import { CID } from 'multiformats/cid'
import type { CID } from 'ipfs-core'

export default async function main() {
const node = await create()
Expand Down
1 change: 1 addition & 0 deletions examples/types-use-ipfs-from-ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"compilerOptions": {
"strict": true,
"skipLibCheck": true,
"lib": ["ES2020", "ES2020.Promise", "ES2020.String", "ES2020.BigInt", "DOM", "DOM.Iterable"],
"noImplicitAny": false,
"esModuleInterop": true,
"moduleResolution": "Node",
Expand Down
3 changes: 2 additions & 1 deletion examples/types-use-ipfs-from-typed-js/src/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const { create } = require('ipfs-core')

/**
* @typedef {import('ipfs-core-types').IPFS} IPFS
* @typedef {import('multiformats/cid').CID} CID
* @typedef {import('ipfs-core').CID} CID
*/

async function main () {
Expand Down
1 change: 1 addition & 0 deletions examples/types-use-ipfs-from-typed-js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"lib": ["ES2020", "ES2020.Promise", "ES2020.String", "ES2020.BigInt", "DOM", "DOM.Iterable"],
"strict": true,
"skipLibCheck": true,
"noImplicitAny": false,
Expand Down