Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 1823

@call decorator for callable objects?

$
0
0

I notice that vitest allows you to extend your test function with skipIf, only, each, etc:

import { assert, test } from 'vitest'

const isDev = process.env.NODE_ENV === 'development'

test.skipIf(isDev)('prod only test', () => {
  // this test only runs in production
})

doing bindings for this i would expect test to be an opaque type, but then I’m looking for a way to make that object callable…I suppose i can use %raw but how would you do it?

	type test
	@module("vitest") external t: test = "test"
        @send external skipIf: (test, bool) => test = "skipIf"
        ....
        let call: (test, string, () => unit) => unit = %raw(`(a, b, c) => a(b, c)`)

Viewing all articles
Browse latest Browse all 1823

Trending Articles