Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: persist @ts-expect-error comments in typing files #16

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
},
rules: {
semi: "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/semi": "off",
"@typescript-eslint/promise-function-async": "off",
"@typescript-eslint/explicit-function-return-type": "off",
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ $ yarn generate:open-api:dev

Fix manually the known issues issues in the generated code:

- Add `// @ts-expect-error` for imports for `ImageSizeRequest`, `OnlyUserIDRequest` in the `gen/chat/FilesApi.ts` and `gen/chat/MessagesApi.ts` files
- Add `// @ts-expect-error` for duplicate exports in `gen/chat/index.ts`
- Add `/** @ts-expect-error */ ` for imports for `ImageSizeRequest`, `OnlyUserIDRequest` in the `gen/chat/FilesApi.ts` and `gen/chat/MessagesApi.ts` files
- Add `/** @ts-expect-error */ ` for duplicate exports in `gen/chat/index.ts`
- Fix the query param serizalization in the `gen/chat/MessagesApi.ts` file's `getManyMessagesRaw` function. This is the correct serialization:

```typescript
Expand Down
6 changes: 3 additions & 3 deletions src/StreamChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export class StreamChannel {
public id?: string,
) {
const configuration = this.streamClient.getConfiguration();
// @ts-expect-error typing problem
/** @ts-expect-error */
this.channelsApi = new ChannelsApi(configuration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.messagesApi = new MessagesApi(configuration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.eventsApi = new EventsApi(configuration);
}

Expand Down
8 changes: 4 additions & 4 deletions src/StreamChatClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export class StreamChatClient {

constructor(private readonly streamClient: StreamClient) {
const configuration = this.streamClient.getConfiguration();
// @ts-expect-error typing problem
/** @ts-expect-error */
this.settingsApi = new SettingsApi(configuration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.channelTypesApi = new ChannelTypesApi(configuration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.channelsApi = new ChannelsApi(configuration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.commandsApi = new CustomCommandsApi(configuration);
}

Expand Down
24 changes: 12 additions & 12 deletions src/StreamClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,23 @@ export class StreamClient {
}

const chatConfiguration = this.getConfiguration();
// @ts-expect-error typing problem
/** @ts-expect-error */
this.usersApi = new UsersApi(chatConfiguration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.devicesApi = new DevicesApi(chatConfiguration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.pushApi = new PushApi(chatConfiguration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.serversideApi = new ServerSideApi(chatConfiguration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.testingApi = new TestingApi(chatConfiguration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.permissionsApi = new PermissionsV2Api(chatConfiguration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.settingsApi = new SettingsApi(chatConfiguration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.eventsApi = new EventsApi(chatConfiguration);
// @ts-expect-error typing problem
/** @ts-expect-error */
this.tasksApi = new TasksApi(chatConfiguration);
}

Expand Down Expand Up @@ -292,7 +292,7 @@ export class StreamClient {
queryUsers = async (payload: QueryUsersRequest) => {
payload.user = this.mapCustomDataBeforeSend(payload.user);
const response = await this.usersApi.queryUsers({ payload });
// @ts-expect-error typing problem
/** @ts-expect-error */
response.users = response.users.map((u) =>
this.mapCustomDataAfterReceive(u),
);
Expand Down Expand Up @@ -349,7 +349,7 @@ export class StreamClient {
users: UpdateUserPartialRequest[];
}) => {
const response = await this.usersApi.updateUsersPartial({
// @ts-expect-error typing error
/** @ts-expect-error */
updateUserPartialRequest: request,
});
Object.keys(response.users).forEach((key) => {
Expand Down Expand Up @@ -572,7 +572,7 @@ export class StreamClient {
if (!user) {
return undefined;
}
// @ts-expect-error typing problem
/** @ts-expect-error */
const result: UserObject | UserResponse = {};
Object.keys(user).forEach((key) => {
if (!this.reservedKeywords.includes(key)) {
Expand Down
4 changes: 2 additions & 2 deletions src/gen/chat/apis/FilesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import type {
APIError,
FileDeleteResponse,
FileUploadResponse,
// @ts-expect-error
/** @ts-expect-error */
ImageSizeRequest,
ImageUploadResponse,
// @ts-expect-error
/** @ts-expect-error */
OnlyUserIDRequest,
} from '../models';

Expand Down
4 changes: 2 additions & 2 deletions src/gen/chat/apis/MessagesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import type {
GetOGResponse,
GetReactionsResponse,
GetRepliesResponse,
// @ts-expect-error
/** @ts-expect-error */
ImageSizeRequest,
ImageUploadResponse,
MarkChannelsReadRequest,
Expand All @@ -34,7 +34,7 @@ import type {
MessageActionRequest,
MessageResponse,
MessageWithPendingMetadataResponse,
// @ts-expect-error
/** @ts-expect-error */
OnlyUserIDRequest,
QueryMessageFlagsRequest,
QueryMessageFlagsResponse,
Expand Down
16 changes: 8 additions & 8 deletions src/gen/chat/apis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ export * from './DefaultApi';
export * from './DevicesApi';
export * from './EventsApi';
export * from './FilesApi';
// @ts-expect-error
/** @ts-expect-error */
export * from './GDPRApi';
export * from './ImportsApi';
// @ts-expect-error
/** @ts-expect-error */
export * from './MessagesApi';
// @ts-expect-error
/** @ts-expect-error */
export * from './ModerationApi';
export * from './PermissionsV2Api';
// @ts-expect-error
/** @ts-expect-error */
export * from './PushApi';
// @ts-expect-error
/** @ts-expect-error */
export * from './ReactionsApi';
export * from './ServerSideApi';
// @ts-expect-error
/** @ts-expect-error */
export * from './SettingsApi';
export * from './TasksApi';
// @ts-expect-error
/** @ts-expect-error */
export * from './TestingApi';
// @ts-expect-error
/** @ts-expect-error */
export * from './UsersApi';
Loading