From 2f8f6431d1ff894939485c47d42775162cee740f Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 16 May 2021 18:18:45 +0900 Subject: [PATCH] :v: --- src/endpoints.ts | 2 +- src/{types.ts => entities.ts} | 0 src/index.ts | 5 ++--- test-d/api.ts | 14 ++++++++++++++ test-d/index.ts | 1 - 5 files changed, 17 insertions(+), 5 deletions(-) rename src/{types.ts => entities.ts} (100%) create mode 100644 test-d/api.ts delete mode 100644 test-d/index.ts diff --git a/src/endpoints.ts b/src/endpoints.ts index c9f89fd438..7c0fe6b836 100644 --- a/src/endpoints.ts +++ b/src/endpoints.ts @@ -1,4 +1,4 @@ -import { ID, InstanceMetadata, Note, OriginType, Page, ServerInfo, Stats, User, UserSorting } from './types'; +import { ID, InstanceMetadata, Note, OriginType, Page, ServerInfo, Stats, User, UserSorting } from './entities'; type TODO = Record; diff --git a/src/types.ts b/src/entities.ts similarity index 100% rename from src/types.ts rename to src/entities.ts diff --git a/src/index.ts b/src/index.ts index 399f8ff1dc..b5f5a5629c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,13 +1,12 @@ -import { APIClient } from './api'; import { Endpoints } from './endpoints'; import Stream from './streaming'; import { Acct } from './acct'; export { - APIClient, Endpoints, Stream, Acct }; -export * as entities from './types'; +export * as api from './api'; +export * as entities from './entities'; diff --git a/test-d/api.ts b/test-d/api.ts new file mode 100644 index 0000000000..32357c2a3b --- /dev/null +++ b/test-d/api.ts @@ -0,0 +1,14 @@ +/** + * Unit testing TypeScript types. + * with https://github.com/SamVerschueren/tsd + */ + +import { expectType } from 'tsd'; +import * as Misskey from '../src'; + +describe('API', () => { + test('returns node that has sprcified type', async () => { + const res = await Misskey.api.request('https://misskey.test', 'meta', { detail: true }, 'TOKEN'); + expectType(res); + }); +}); diff --git a/test-d/index.ts b/test-d/index.ts deleted file mode 100644 index e6fafcc4ff..0000000000 --- a/test-d/index.ts +++ /dev/null @@ -1 +0,0 @@ -// RESERVED