Skip to content

Commit

Permalink
Make warnings from API Extractor output errors instead (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesBurnside authored Apr 9, 2021
1 parent f8a65a7 commit 6de72cc
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Update API extractor warnings to be errors",
"packageName": "@azure/acs-chat-declarative",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Update API extractor warnings to be errors",
"packageName": "@azure/acs-chat-selector",
"email": "[email protected]",
"dependentChangeType": "none"
}
3 changes: 2 additions & 1 deletion common/api-extractor/api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"logLevel": "none"
},
"ae-forgotten-export": {
"logLevel": "error"
"logLevel": "error",
"addToApiReportFile": false
}
},
"tsdocMessageReporting": {
Expand Down
52 changes: 50 additions & 2 deletions packages/acs-chat-declarative/review/acs-chat-declarative.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,62 @@ export type ChatConfig = {
displayName: string;
};

// @public (undocumented)
export class ChatContext {
// (undocumented)
addReadReceipt(threadId: string, readReceipt: ReadReceipt): void;
// (undocumented)
addTypingIndicator(threadId: string, typingIndicator: TypingIndicator): void;
// (undocumented)
batch(batchFunc: () => void): void;
// (undocumented)
createThread(threadId: string, threadInfo?: ChatThreadInfo): void;
// (undocumented)
createThreadIfNotExist(threadId: string, thread?: ChatThreadInfo): boolean;
// (undocumented)
deleteLocalMessage(threadId: string, localId: string): boolean;
// (undocumented)
deleteMessage(threadId: string, id: string): void;
// (undocumented)
deleteParticipant(threadId: string, participantId: string): void;
// (undocumented)
deleteParticipants(threadId: string, participantIds: string[]): void;
// (undocumented)
deleteThread(threadId: string): void;
// (undocumented)
getState(): ChatClientState;
// (undocumented)
offStateChange(handler: (state: ChatClientState) => void): void;
// (undocumented)
onStateChange(handler: (state: ChatClientState) => void): void;
// (undocumented)
setChatMessage(threadId: string, message: ChatMessageWithStatus): void;
// (undocumented)
setChatMessages(threadId: string, messages: Map<string, ChatMessageWithStatus>): void;
// (undocumented)
setParticipant(threadId: string, participant: ChatParticipant): void;
// (undocumented)
setParticipants(threadId: string, participants: ChatParticipant[]): void;
// (undocumented)
setState(state: ChatClientState): void;
// (undocumented)
setThread(threadId: string, threadState: ChatThreadClientState): void;
// (undocumented)
updateChatConfig(config: ChatConfig): void;
// (undocumented)
updateChatMessageContent(threadId: string, messagesId: string, content: string | undefined): void;
// (undocumented)
updateThread(threadId: string, threadInfo?: ChatThreadInfo): void;
// (undocumented)
updateThreadTopic(threadId: string, topic?: string): void;
}

// @public (undocumented)
export type ChatMessageWithStatus = ChatMessage & {
clientMessageId?: string;
status: MessageStatus;
};

// Warning: (ae-forgotten-export) The symbol "ChatContext" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const chatThreadClientDeclaratify: (chatThreadClient: ChatThreadClient, context: ChatContext) => ChatThreadClient;

Expand Down
1 change: 1 addition & 0 deletions packages/acs-chat-declarative/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// © Microsoft Corporation. All rights reserved.
export { chatClientDeclaratify } from './ChatClientDeclarative';
export { ChatContext } from './ChatContext';
export { chatThreadClientDeclaratify } from './ChatThreadClientDeclarative';

export type { DeclarativeChatClient } from './ChatClientDeclarative';
Expand Down
24 changes: 19 additions & 5 deletions packages/acs-chat-selector/review/acs-chat-selector.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ import { MessageStatus } from '@azure/acs-chat-declarative';
import { ReactElement } from 'react';
import * as reselect from 'reselect';

// Warning: (ae-forgotten-export) The symbol "BaseChatConfigProps" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type BaseChatConfigProps = {
displayName: string;
userId: string;
threadId: string;
};

// @public (undocumented)
export const chatThreadSelector: reselect.OutputParametricSelector<ChatClientState, BaseChatConfigProps, {
userId: string;
Expand All @@ -39,12 +44,21 @@ export const chatThreadSelector: reselect.OutputParametricSelector<ChatClientSta
}[];
}>;

// Warning: (ae-forgotten-export) The symbol "DefaultHandlers" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "CommonProperties" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type CommonProperties<A, B> = {
[P in keyof A & keyof B]: A[P] extends B[P] ? (A[P] extends B[P] ? P : never) : never;
}[keyof A & keyof B];

// @public (undocumented)
export const createDefaultHandlersForComponent: <Props>(chatClient: DeclarativeChatClient, chatThreadClient: ChatThreadClient, _: (props: Props) => ReactElement | null) => Pick<DefaultHandlers, CommonProperties<DefaultHandlers, Props>>;

// @public (undocumented)
export type DefaultHandlers = {
onMessageSend: (content: string) => Promise<void>;
onMessageSeen: (chatMessageId: string) => Promise<void>;
onTyping: () => Promise<void>;
};

// @public (undocumented)
export const sendBoxSelector: reselect.OutputParametricSelector<ChatClientState, BaseChatConfigProps, {
displayName: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/acs-chat-selector/src/handlers/createHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DeclarativeChatClient } from '@azure/acs-chat-declarative';
import { ChatThreadClient } from '@azure/communication-chat';
import memoizeOne from 'memoize-one';

type DefaultHandlers = {
export type DefaultHandlers = {
onMessageSend: (content: string) => Promise<void>;
onMessageSeen: (chatMessageId: string) => Promise<void>;
onTyping: () => Promise<void>;
Expand All @@ -25,7 +25,7 @@ const createDefaultHandlers = memoizeOne((chatClient: DeclarativeChatClient, cha
};
});

type CommonProperties<A, B> = {
export type CommonProperties<A, B> = {
[P in keyof A & keyof B]: A[P] extends B[P] ? (A[P] extends B[P] ? P : never) : never;
}[keyof A & keyof B];

Expand Down
5 changes: 4 additions & 1 deletion packages/acs-chat-selector/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// © Microsoft Corporation. All rights reserved.
export { chatThreadSelector } from './chatThreadSelector';
export { sendBoxSelector } from './sendBoxSelector';
export { createDefaultHandlersForComponent } from './handlers/createHandlers';
export { sendBoxSelector } from './sendBoxSelector';

export type { BaseChatConfigProps } from './baseSelectors';
export type { CommonProperties, DefaultHandlers } from './handlers/createHandlers';

0 comments on commit 6de72cc

Please sign in to comment.