MetaMask / MetaMask/core

[utils] Add tests for opaque types

Open
#10,200 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

We've added opaque types in MetaMask/snaps-monorepo#961. Those types are not testable using normal jest, but we can use tsd to write tests for types like we do in https://github.com/MetaMask/utils/blob/main/src/json.test-d.ts.

We should ensure that `SemVerVersion` and `SemVerRange` are not assignable to each other.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/json.test-d.ts, which demonstrates the repository's tsd type-test pattern. Add equivalent coverage for SemVerVersion and SemVerRange, checking that neither is assignable to the other; done means the tsd checks pass and reject those assignments.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.