Types!
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
e45b1a1e41
commit
34f3e62f72
3 changed files with 13 additions and 5 deletions
2
src/@types/svg.d.ts
vendored
2
src/@types/svg.d.ts
vendored
|
@ -15,6 +15,6 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
declare module "*.svg" {
|
||||
const content: any;
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,14 @@ const addressTypeName = {
|
|||
'email': _td("email address"),
|
||||
};
|
||||
|
||||
interface IResult {
|
||||
user_id: string; // eslint-disable-line camelcase
|
||||
room_id?: string; // eslint-disable-line camelcase
|
||||
name?: string;
|
||||
display_name?: string; // eslint-disable-line camelcase
|
||||
avatar_url?: string;// eslint-disable-line camelcase
|
||||
}
|
||||
|
||||
interface IProps {
|
||||
title: string;
|
||||
description?: JSX.Element;
|
||||
|
@ -422,7 +430,7 @@ export default class AddressPickerDialog extends React.Component<IProps, IState>
|
|||
this.processResults(results, query);
|
||||
}
|
||||
|
||||
private processResults(results, query: string): void {
|
||||
private processResults(results: IResult[], query: string): void {
|
||||
const suggestedList = [];
|
||||
results.forEach((result) => {
|
||||
if (result.room_id) {
|
||||
|
@ -490,7 +498,7 @@ export default class AddressPickerDialog extends React.Component<IProps, IState>
|
|||
});
|
||||
}
|
||||
|
||||
private addAddressesToList(addressTexts): IUserAddress[] {
|
||||
private addAddressesToList(addressTexts: string[]): IUserAddress[] {
|
||||
const selectedList = this.state.selectedList.slice();
|
||||
|
||||
let hasError = false;
|
||||
|
@ -533,7 +541,7 @@ export default class AddressPickerDialog extends React.Component<IProps, IState>
|
|||
return hasError ? null : selectedList;
|
||||
}
|
||||
|
||||
private async lookupThreepid(medium, address): Promise<string> {
|
||||
private async lookupThreepid(medium: AddressType, address: string): Promise<string> {
|
||||
let cancelled = false;
|
||||
// Note that we can't safely remove this after we're done
|
||||
// because we don't know that it's the same one, so we just
|
||||
|
|
|
@ -163,7 +163,7 @@ export default class AddressSelector extends React.Component<IProps, IState> {
|
|||
return addressList;
|
||||
}
|
||||
|
||||
private maxSelected(list): number {
|
||||
private maxSelected(list: IUserAddress[]): number {
|
||||
const listSize = list.length === 0 ? 0 : list.length - 1;
|
||||
const maxSelected = listSize > (this.props.truncateAt - 1) ? (this.props.truncateAt - 1) : listSize;
|
||||
return maxSelected;
|
||||
|
|
Loading…
Reference in a new issue