-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix: fix arethetypesworking errors in all packages #1004
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f40cc38
did-mailto tsconfig.json uses moduleResolution and module NodeNext to…
gobengo f7acf63
capabilities package builds with module/moduleResolution NodeNext to …
gobengo 7a95162
packages/access-client uses tsconfig module/moduleResolution of NodeN…
gobengo 7d44289
upload-api package is tsc with module/moduleResolution of NodeNext to…
gobengo baca19f
wip fix upload-client
gobengo e4e431d
w3up-client package uses module/moduleResolution NodeNext and now pas…
gobengo 51fac46
filecoin-client fix attw
gobengo 52724b2
fix attw in filecoin-api
gobengo 7b6139a
root tsconfig.json (that others inherit from) use module=NodeNext and…
gobengo 8980d10
Merge branch 'main' into fix-attw-1698165616
gobengo 89f5c5e
all packages have an attw script
gobengo 41ab164
github workflows for access-client and w3up-client run attw
gobengo 5f1920d
prettier .attw.json
gobengo f8652a5
prettier
gobengo 3b4156c
add atty as monorepo devDep
gobengo 433ab1d
module=Node16 not NodeNext
gobengo cdf8b53
rm this file now that I merged in another commits that moves it to a …
gobengo 7382e3d
rm unused var
gobengo 1b5a476
remove child tsconfig.json explicitly using module=NodeNext and inste…
gobengo df5995b
add rationale for ts-expect-error in unixfs.test.js import of blockst…
gobengo e9882a4
rm unused ts-ignore
gobengo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"ignoreRules": ["cjs-resolves-to-esm"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../.attw.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,16 @@ import { CID } from 'multiformats' | |
import { Access } from '@web3-storage/capabilities' | ||
import { isExpired } from './delegations.js' | ||
|
||
/** @typedef {import('./types').AgentDataModel} AgentDataModel */ | ||
/** @typedef {import('./types.js').AgentDataModel} AgentDataModel */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is one of many small changes to ensure all imported module identifiers (e.g. type imports in comments like this) have a file suffix, which is required by |
||
|
||
/** @implements {AgentDataModel} */ | ||
export class AgentData { | ||
/** @type {(data: import('./types').AgentDataExport) => Promise<void> | void} */ | ||
/** @type {(data: import('./types.js').AgentDataExport) => Promise<void> | void} */ | ||
#save | ||
|
||
/** | ||
* @param {import('./types').AgentDataModel} data | ||
* @param {import('./types').AgentDataOptions} [options] | ||
* @param {import('./types.js').AgentDataModel} data | ||
* @param {import('./types.js').AgentDataOptions} [options] | ||
*/ | ||
constructor(data, options = {}) { | ||
this.meta = data.meta | ||
|
@@ -30,8 +30,8 @@ export class AgentData { | |
/** | ||
* Create a new AgentData instance from the passed initialization data. | ||
* | ||
* @param {Partial<import('./types').AgentDataModel>} [init] | ||
* @param {import('./types').AgentDataOptions} [options] | ||
* @param {Partial<import('./types.js').AgentDataModel>} [init] | ||
* @param {import('./types.js').AgentDataOptions} [options] | ||
*/ | ||
static async create(init = {}, options = {}) { | ||
const agentData = new AgentData( | ||
|
@@ -53,11 +53,11 @@ export class AgentData { | |
/** | ||
* Instantiate AgentData from previously exported data. | ||
* | ||
* @param {import('./types').AgentDataExport} raw | ||
* @param {import('./types').AgentDataOptions} [options] | ||
* @param {import('./types.js').AgentDataExport} raw | ||
* @param {import('./types.js').AgentDataOptions} [options] | ||
*/ | ||
static fromExport(raw, options) { | ||
/** @type {import('./types').AgentDataModel['delegations']} */ | ||
/** @type {import('./types.js').AgentDataModel['delegations']} */ | ||
const dels = new Map() | ||
|
||
for (const [key, value] of raw.delegations) { | ||
|
@@ -89,7 +89,7 @@ export class AgentData { | |
* Export data in a format safe to pass to `structuredClone()`. | ||
*/ | ||
export() { | ||
/** @type {import('./types').AgentDataExport} */ | ||
/** @type {import('./types.js').AgentDataExport} */ | ||
const raw = { | ||
meta: this.meta, | ||
principal: this.principal.toArchive(), | ||
|
@@ -112,7 +112,7 @@ export class AgentData { | |
/** | ||
* @deprecated | ||
* @param {import('@ucanto/interface').DID} did | ||
* @param {import('./types').SpaceMeta} meta | ||
* @param {import('./types.js').SpaceMeta} meta | ||
* @param {import('@ucanto/interface').Delegation} [proof] | ||
*/ | ||
async addSpace(did, meta, proof) { | ||
|
@@ -131,7 +131,7 @@ export class AgentData { | |
|
||
/** | ||
* @param {import('@ucanto/interface').Delegation} delegation | ||
* @param {import('./types').DelegationMeta} [meta] | ||
* @param {import('./types.js').DelegationMeta} [meta] | ||
*/ | ||
async addDelegation(delegation, meta) { | ||
this.delegations.set(delegation.cid.toString(), { | ||
|
@@ -162,7 +162,7 @@ const isSessionCapability = (cap) => cap.can === Access.session.can | |
* Is the given delegation a session proof? | ||
* | ||
* @param {Ucanto.Delegation} delegation | ||
* @returns {delegation is Ucanto.Delegation<[import('./types').AccessSession]>} | ||
* @returns {delegation is Ucanto.Delegation<[import('./types.js').AccessSession]>} | ||
*/ | ||
export const isSessionProof = (delegation) => | ||
delegation.capabilities.some((cap) => isSessionCapability(cap)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../.attw.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../.attw.json |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changing where this points to resolved some atty errors. When we do it this way and let typescript also write the type declaration files with all its defaults next to the source files, then when another tsc in a depending lib finds all this config, it'll be able to find the src,types,etc again.
There are some tricky bits here that I learned from https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseESM.md#common-causes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the npm published files so we don't include src in the root?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alanshaw #1012