0

I am using a minimal testing library (Tape) which has a handful of testing methods available similar to many test frameworks. I have a type alias and an object which implements it.

export type myType = {
   myFunc(cb: (val: string) => void): void
}

const myObj = {
   myFunc: (cb) => { return }
} as myType

Using how can I test that an object implements the myType type alias using tape.equal(actual, expected) or otherwise?

myol
  • 8,857
  • 19
  • 82
  • 143
  • Your `myObj` code isn't valid JS syntax. Please consider modifying the code to constitute a [mcve] suitable from dropping into an IDE to demonstrate your issue. – jcalz Mar 19 '21 at 14:08
  • Good catch, updated – myol Mar 19 '21 at 14:23
  • No, that still doesn't work. You might want to test out your example code in an IDE like the TypeScript playground ([link](https://tsplay.dev/NalkBw)) to make sure it has no obvious typos or other problems. – jcalz Mar 19 '21 at 14:26
  • 1
    Updated again. Thank you I will note that site for future SO use – myol Mar 19 '21 at 14:33

0 Answers0