Skip to content

Commit

Permalink
feat: always loose rdns
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Jul 20, 2023
1 parent 4ce3665 commit a988de7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/quick-forks-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"mipd": patch
---

Always set loose autocomplete on `rdns` type.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ In some cases you might want to tune the global types (e.g. the `EIP1193Provider
| Type | Default | Description |
| ------------------- | -------------------------------------------------------------- | ---------------------- |
| `provider` | `import('viem').EIP1193Provider` | The EIP-1193 Provider. |
| `rdns` | `'com.coinbase' | 'com.enkrypt' | 'io.metamask' | 'io.zerion'` | Deterministic identifier for the Provider in the form of an rDNS (Reverse Domain Name Notation) |
| `rdns` | `'com.coinbase' \| 'com.enkrypt' \| 'io.metamask' \| 'io.zerion'` | Deterministic identifier for the Provider in the form of an rDNS (Reverse Domain Name Notation) |

Configuration options are customizable using [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html). Extend the `Register` interface either directly in your code or in a `d.ts` file (e.g. `eip6963.d.ts`):

Expand Down
8 changes: 5 additions & 3 deletions src/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ export type ResolvedRegister = {
? provider
: DefaultRegister['provider']
/** Reverse Domain Name Notation (rDNS) of the Wallet Provider. */
rdns: Register extends { rdns: infer rdns extends string }
? rdns
: DefaultRegister['rdns'] | (string & {}) // loose autocomplete
rdns:
| (Register extends { rdns: infer rdns extends string }
? rdns
: DefaultRegister['rdns'])
| (string & {}) // loose autocomplete
}

export type EIP1193Provider = ResolvedRegister['provider']
Expand Down

0 comments on commit a988de7

Please sign in to comment.