From b2584c0e805476a971d24e22350caf3875b42dd0 Mon Sep 17 00:00:00 2001 From: Li Zhineng Date: Wed, 23 Jul 2025 21:15:21 +0800 Subject: test types --- tests/index.test-d.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/index.test-d.ts (limited to 'tests/index.test-d.ts') diff --git a/tests/index.test-d.ts b/tests/index.test-d.ts new file mode 100644 index 0000000..52df93c --- /dev/null +++ b/tests/index.test-d.ts @@ -0,0 +1,32 @@ +import { expectType } from 'tsd' +import { Client } from '../src' + +interface User { + name: string +} + +;async () => { + const response = await Client.new().get('http://example.com') + expectType( + response.data() + ) +} + +;async () => { + const response = await Client.new().get('http://example.com') + expectType(response.data()) +} + +;async () => { + const response = await Client.new().get('http://example.com/string') + expectType(response.data()) +} + +;async () => { + const response = await Client.new().upload({ + url: 'http://example.com', + filePath: '/tmp/foo.txt', + name: 'file' + }) + expectType(response.data()) +} -- cgit v1.2.3