Skip to content

Commit 74e1b73

Browse files
authored
chore: fix types (#3608)
Updates deps, fixes typos. Not sure why the compiler doesn't pick up things like this.
1 parent 4268c06 commit 74e1b73

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,22 @@
4141
"lint": "aegir lint",
4242
"coverage": "npx nyc -r html npm run test:node -- --bail",
4343
"clean": "rimraf ./dist",
44-
"dep-check": "aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i abort-controller"
44+
"dep-check": "aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i abort-controller -i ipld"
4545
},
4646
"dependencies": {
4747
"abort-controller": "^3.0.0",
4848
"any-signal": "^2.1.2",
49-
"cids": "^1.1.5",
49+
"cids": "^1.1.6",
5050
"debug": "^4.1.1",
5151
"form-data": "^4.0.0",
5252
"ipfs-core-types": "^0.3.1",
5353
"ipfs-core-utils": "^0.7.2",
5454
"ipfs-unixfs": "^4.0.1",
5555
"ipfs-utils": "^6.0.4",
56+
"ipld": "^0.29.0",
5657
"ipld-block": "^0.11.0",
5758
"ipld-dag-cbor": "^0.18.0",
58-
"ipld-dag-pb": "^0.22.0",
59+
"ipld-dag-pb": "^0.22.1",
5960
"ipld-raw": "^7.0.0",
6061
"it-last": "^1.0.4",
6162
"it-map": "^1.0.4",

src/lib/core.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const DEFAULT_HOST = isBrowser || isWebWorker ? location.hostname : 'localhost'
1515
const DEFAULT_PORT = isBrowser || isWebWorker ? location.port : '5001'
1616

1717
/**
18-
* @typedef {import('electron-fetch').Response} Response
19-
* @typedef {import('ipfs-utils/dist/types/electron-fetch').Request} Request
18+
* @typedef {import('ipfs-utils/dist/types/native-fetch').Response} Response
19+
* @typedef {import('ipfs-utils/dist/types/native-fetch').Request} Request
2020
* @typedef {import('ipfs-utils/src/types').HTTPOptions} HTTPOptions
2121
* @typedef {import('../types').Options} Options
2222
*/
@@ -188,7 +188,6 @@ class Client extends HTTP {
188188
/**
189189
* @param {string | Request} resource
190190
* @param {HTTPOptions} options
191-
* @returns {Promise<import('ipfs-utils/dist/types/electron-fetch').Response>}
192191
*/
193192
this.fetch = (resource, options = {}) => {
194193
if (typeof resource === 'string' && !resource.startsWith('/')) {

src/lib/ipld-formats.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ module.exports = ({ formats = [], loadFormat = noop } = {}) => {
4545
* @param {import('multicodec').CodecName} codec - The code to load the format for
4646
*/
4747
const loadResolver = async (codec) => {
48-
// @ts-ignore - codec is a string and not a CodecName
49-
const number = multicodec.getNumber(codec)
48+
const number = multicodec.getCodeFromName(codec)
49+
// @ts-ignore wat
5050
const format = configuredFormats[number] || await loadFormat(codec)
5151

5252
if (!format) {

src/types.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@ import { Format as IPLDFormat } from 'interface-ipld-format'
22
import { LoadFormatFn } from 'ipld'
33
import { Agent as HttpAgent } from 'http'
44
import { Agent as HttpsAgent } from 'https'
5+
import Multiaddr from 'multiaddr'
56

67
export interface Options {
78
host?: string
89
port?: number
910
protocol?: string
1011
headers?: Headers | Record<string, string>
11-
timeout?: number | sttring
12+
timeout?: number | string
1213
apiPath?: string
1314
url?: URL|string|Multiaddr
1415
ipld?: IPLDOptions
1516
agent?: HttpAgent | HttpsAgent
1617
}
1718

1819
export interface IPLDOptions {
19-
formats?: IPLDFormat[]
20+
formats?: IPLDFormat<any>[]
2021
loadFormat?: LoadFormatFn
2122
}
2223

0 commit comments

Comments
 (0)