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