Skip to content
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

feat: make types compatible with deno #223

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dchambers
Copy link

@dchambers dchambers commented May 27, 2024

Guarantee type compatibility with even the built in npm support in Deno.

Relevant context here, though in the case of @mesh/core types are also not pulling through in all cases when using a CDN (via https://esm.sh/@meshsdk/core@1.5.17) either:

Guarantee type compatibility with even the built in `npm` support in Deno.
Copy link

vercel bot commented May 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mesh-docs ❌ Failed (Inspect) May 27, 2024 10:02am

Copy link

vercel bot commented May 27, 2024

@dchambers is attempting to deploy a commit to the MeshJS Team on Vercel.

A member of the Team first needs to authorize it.

@@ -1,3 +1,3 @@
import CIP14 from '@emurgo/cip14-js';

export const AssetFingerprint = CIP14;
export const AssetFingerprint = CIP14.default;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only code change within the PR.

@@ -71,7 +71,8 @@ export class MeshEscrowContract extends MeshTxInitiator {
await this.mesh
.txOut(scriptAddr, escrowAmount)
.txOutInlineDatumValue(
initiateEscrowDatum(walletAddress, escrowAmount),
// TODO: remove dodgy cast
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the only genuine code change within this PR (search for "This is the only code change within the PR.") exists only to deal with a strange default export issue, the fact that we're now having to perform some explicit casts potentially indicates that types weren't always being pulled through correctly even internally?

import { csl } from '@mesh/core';
import type { Costmdls } from '@mesh/core';
import type { Budget, Era, Network, Protocol } from './types';
import { csl } from '../core/index.js';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably could have achieved a basic level of Deno support (via CDNs which fix-up some ESM issues) just by no longer using the @mesh/* alias. The need for the .js suffixes is a result of setting moduleResolution to Node16, which additionally guarantees compatibility with Deno's built-in npm support, but which also ensures that support will continue to work in the future too.

@@ -25,9 +25,9 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */

/* Modules */
"module": "ESNext", /* Specify what module code is generated. */
"module": "Node16", /* Specify what module code is generated. */
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This had to be changed as a consequence of changing moduleResolution to Node16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant