Frontend: Fix types - no errors
This commit is contained in:
parent
24609ef7a8
commit
031d8dfcf1
@ -1,6 +1,6 @@
|
||||
import { Document, model, Schema } from 'mongoose';
|
||||
import patterns from '@accord/types/patterns';
|
||||
import { PermissionTypes } from '@accord/types/permission.types';
|
||||
import { PermissionTypes } from '@accord/types/permissions';
|
||||
import { createdAtToDate, useId } from '../../utils/utils';
|
||||
import validators from '../../utils/validators';
|
||||
import { generateSnowflake } from '../snowflake-entity';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { UpdateQuery } from 'mongoose';
|
||||
import { PermissionTypes } from '@accord/types/permission.types';
|
||||
import { PermissionTypes } from '@accord/types/permissions';
|
||||
import DBWrapper from './db-wrapper';
|
||||
import { hasPermission, Role, RoleDocument } from './models/role';
|
||||
import { generateSnowflake } from './snowflake-entity';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { NextFunction, Request, Response } from 'express';
|
||||
import { GuildDocument } from '../../data/models/guild';
|
||||
import { PermissionTypes } from '@accord/types/permission.types';
|
||||
import { PermissionTypes } from '@accord/types/permissions';
|
||||
import { APIError } from '../modules/api-error';
|
||||
|
||||
export default (permission: PermissionTypes.Permission) =>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Router } from 'express';
|
||||
import { PermissionTypes } from '@accord/types/permission.types';
|
||||
import { PermissionTypes } from '@accord/types/permissions';
|
||||
import { Guild } from '../../data/models/guild';
|
||||
import updateUser from '../middleware/update-user';
|
||||
import validateUser from '../middleware/validate-user';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Guild } from '../../data/models/guild';
|
||||
import { Socket } from 'socket.io';
|
||||
import { PermissionTypes, getPermString } from '@accord/types/permission.types';
|
||||
import { PermissionTypes, getPermString } from '@accord/types/permissions';
|
||||
|
||||
export class WSGuard {
|
||||
public userId(client: Socket) {
|
||||
|
@ -5,7 +5,7 @@ import { Guild, GuildDocument } from '../../data/models/guild';
|
||||
import { GuildMember } from '../../data/models/guild-member';
|
||||
import { SelfUserDocument, User } from '../../data/models/user';
|
||||
import Users from '../../data/users';
|
||||
import { PermissionTypes } from '@accord/types/permission.types';
|
||||
import { PermissionTypes } from '@accord/types/permissions';
|
||||
|
||||
|
||||
import { WSGuard } from '../modules/ws-guard';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Socket } from 'socket.io';
|
||||
import { PermissionTypes } from '@accord/types/permission.types';
|
||||
import { PermissionTypes } from '@accord/types/permissions';
|
||||
import { Guild } from '../../data/models/guild';
|
||||
import { Role } from '../../data/models/role';
|
||||
import { generateSnowflake } from '../../data/snowflake-entity';
|
||||
|
@ -2,7 +2,7 @@ import { generateSnowflake } from '../../../src/data/snowflake-entity';
|
||||
import { test, given } from '@accord/ion';
|
||||
import { longString, mongooseError } from '../../test-utils';
|
||||
import { Role } from '../../../src/data/models/role';
|
||||
import { PermissionTypes } from '@accord/types/permission.types';
|
||||
import { PermissionTypes } from '@accord/types/permissions';
|
||||
|
||||
test(createRole, () => {
|
||||
given().expect(true);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { WS } from './ws';
|
||||
import { WS } from '../../types/ws.types';
|
||||
|
||||
declare global {
|
||||
const socket: {
|
12
frontend/package-lock.json
generated
12
frontend/package-lock.json
generated
@ -78,11 +78,7 @@
|
||||
}
|
||||
},
|
||||
"../types": {
|
||||
"name": "@accord/types",
|
||||
"dependencies": {
|
||||
"@accord/backend": "file:../backend/src",
|
||||
"@types/winston": "^2.4.4"
|
||||
}
|
||||
"name": "@accord/types"
|
||||
},
|
||||
"node_modules/@accord/types": {
|
||||
"resolved": "../types",
|
||||
@ -26560,11 +26556,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@accord/types": {
|
||||
"version": "file:../types",
|
||||
"requires": {
|
||||
"@accord/backend": "file:../backend/src",
|
||||
"@types/winston": "^2.4.4"
|
||||
}
|
||||
"version": "file:../types"
|
||||
},
|
||||
"@babel/code-frame": {
|
||||
"version": "7.16.0",
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Util } from '@accord/types';
|
||||
import React from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity } from '@accord/types';
|
||||
import MessageBox from '../message-box/message-box';
|
||||
import { FunctionComponent } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { MessageTypes } from '@accord/types';
|
||||
import { FunctionComponent } from 'react';
|
||||
import Image from '../../utils/image';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import moment from 'moment';
|
||||
import { Entity } from '@accord/types';
|
||||
import { FunctionComponent } from 'react';
|
||||
import { ContextMenuTrigger } from 'react-contextmenu';
|
||||
import { useSelector } from 'react-redux';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity } from '@accord/types';
|
||||
import moment from 'moment';
|
||||
import { FunctionComponent } from 'react';
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity } from '@accord/types';
|
||||
import { faPencilAlt, faTimes } from '@fortawesome/free-solid-svg-icons';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
@ -1,5 +1,6 @@
|
||||
import './message.scoped.css';
|
||||
import './message.global.css';
|
||||
|
||||
import moment from 'moment';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { getChannelMessages } from '../../../store/messages';
|
||||
@ -15,6 +16,7 @@ import { openUserProfile } from '../../../store/ui';
|
||||
import React from 'react';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faArrowLeft, faArrowRight, faInfoCircle } from '@fortawesome/free-solid-svg-icons';
|
||||
import { Entity } from '@accord/types';
|
||||
|
||||
export interface MessageProps {
|
||||
message: Entity.Message;
|
||||
|
@ -6,6 +6,7 @@ import { useEffect, useRef, useState } from 'react';
|
||||
import TextChannelHeader from './text-channel-header';
|
||||
import usePerms from '../../hooks/use-perms';
|
||||
import SkeletonMessage from '../skeleton/skeleton-message';
|
||||
import { Util } from '@accord/types';
|
||||
|
||||
const TextBasedChannel: React.FunctionComponent = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity } from '@accord/types';
|
||||
import { faCross, faTimes } from '@fortawesome/free-solid-svg-icons';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { ContextMenu, MenuItem } from 'react-contextmenu';
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { faBan, faIdCard, faUser } from '@fortawesome/free-solid-svg-icons';
|
||||
import { Entity } from '@accord/types';
|
||||
import { faBan, faUser } from '@fortawesome/free-solid-svg-icons';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { ContextMenu, MenuItem } from 'react-contextmenu';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
@ -6,7 +7,6 @@ import usePerms from '../../../hooks/use-perms';
|
||||
import { getMember, kickMember } from '../../../store/members';
|
||||
import { actions as ui, openUserProfile } from '../../../store/ui';
|
||||
import { toggleBlockUser } from '../../../store/users';
|
||||
import UserProfile from '../../modals/user-profile';
|
||||
import Category from '../../utils/category';
|
||||
import DevModeMenuSection from '../dev-mode-menu-section';
|
||||
import RoleManager from './role-manager';
|
||||
|
@ -4,6 +4,7 @@ import { getGuildRoles } from '../../../store/guilds';
|
||||
import { useState } from 'react';
|
||||
import { updateMember } from '../../../store/members';
|
||||
import usePerms from '../../../hooks/use-perms';
|
||||
import { Entity } from '@accord/types';
|
||||
|
||||
export interface RoleManagerProps {
|
||||
member: Entity.GuildMember;
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity } from '@accord/types';
|
||||
import { faDoorOpen } from '@fortawesome/free-solid-svg-icons';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { ContextMenu, MenuItem } from 'react-contextmenu';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity } from '@accord/types';
|
||||
import { ContextMenu } from 'react-contextmenu';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useParams } from 'react-router-dom';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity } from '@accord/types';
|
||||
import { ContextMenu } from 'react-contextmenu';
|
||||
import { useSelector } from 'react-redux';
|
||||
import DevModeMenuSection from './dev-mode-menu-section';
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Entity } from '@accord/types';
|
||||
import { FunctionComponent } from 'react';
|
||||
import { ContextMenu, MenuItem } from 'react-contextmenu';
|
||||
import { ContextMenu } from 'react-contextmenu';
|
||||
|
||||
interface UserMenuProps {
|
||||
user: Entity.User;
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity } from '@accord/types';
|
||||
import { UseFormRegister, FieldValues } from 'react-hook-form';
|
||||
import Select from 'react-select';
|
||||
|
||||
@ -10,7 +11,7 @@ interface ChannelSelectProps {
|
||||
options?: any;
|
||||
};
|
||||
|
||||
const ChannelSelect: React.FunctionComponent<any> = (props) => {
|
||||
const ChannelSelect: React.FunctionComponent<ChannelSelectProps> = (props) => {
|
||||
const channelOptions: any[] = props.channels
|
||||
.filter(c => c.type === 'TEXT')
|
||||
.map(c => ({ label: `#${c.name}`, value: c.id }));
|
||||
|
@ -14,6 +14,7 @@ import PermOverrides from './perm-overrides';
|
||||
import ScarceSelect from './scarce-select';
|
||||
import clone from 'clone';
|
||||
import { uniqueBy } from '../../../store/utils/filter';
|
||||
import { ChannelTypes } from '@accord/types';
|
||||
|
||||
const ChannelSettingsPerms: React.FunctionComponent = () => {
|
||||
const { guildId }: any = useParams();
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { PermissionTypes } from '@accord/types/permission.types';
|
||||
import { ChannelTypes } from '@accord/types';
|
||||
import { PermissionTypes } from '@accord/types/permissions';
|
||||
import React from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import usePerms from '../../../hooks/use-perms';
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { PermissionTypes } from '@accord/types/permission.types';
|
||||
import { ChannelTypes } from '@accord/types';
|
||||
import { PermissionTypes } from '@accord/types/permissions';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import usePerms from '../../../hooks/use-perms';
|
||||
import { openSaveChanges } from '../../../store/ui';
|
||||
|
@ -4,6 +4,7 @@ import { createChannel } from '../../store/channels';
|
||||
import NormalButton from '../utils/buttons/normal-button';
|
||||
import Input from '../inputs/input';
|
||||
import Modal from './modal';
|
||||
import { ChannelTypes } from '@accord/types';
|
||||
|
||||
const CreateChannel: React.FunctionComponent = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
@ -5,7 +5,7 @@ import { openSaveChanges } from '../../../store/ui';
|
||||
import NormalButton from '../../utils/buttons/normal-button';
|
||||
import Category from '../../utils/category';
|
||||
import Toggle from '../../inputs/toggle';
|
||||
import { PermissionTypes } from '@accord/types/permission.types';
|
||||
import { PermissionTypes } from '@accord/types/permissions';
|
||||
|
||||
export interface RolePermissionsProps {
|
||||
setRoleValue: UseFormSetValue<FieldValues>;
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { UserTypes } from '@accord/types';
|
||||
import { faBug, faGavel, faRocket, faSun, faVideo } from '@fortawesome/free-solid-svg-icons';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import classNames from 'classnames';
|
||||
|
@ -13,6 +13,7 @@ import ChannelMenu from '../../ctx-menus/channel-menu';
|
||||
import Username from '../../user/username';
|
||||
import Draggable from 'react-draggable';
|
||||
import React from 'react';
|
||||
import { Entity } from '@accord/types';
|
||||
|
||||
const ChannelTabs: React.FunctionComponent = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
@ -6,6 +6,7 @@ import GuildMemberMenu from '../ctx-menus/guild-member/guild-member-menu';
|
||||
import { getGuildMembers, getGuildUsers } from '../../store/guilds';
|
||||
import { filterHoistedRoles } from '../../store/roles';
|
||||
import usePerms from '../../hooks/use-perms';
|
||||
import { Entity } from '@accord/types';
|
||||
|
||||
const MemberList: React.FunctionComponent = () => {
|
||||
const perms = usePerms();
|
||||
|
@ -4,6 +4,7 @@ import { getMemberHighestRole } from '../../store/roles';
|
||||
import { useSelector } from 'react-redux';
|
||||
import classNames from 'classnames';
|
||||
import Image from '../utils/image';
|
||||
import { Entity } from '@accord/types';
|
||||
|
||||
export interface UsernameProps {
|
||||
user: Entity.User;
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { WS } from '@accord/types';
|
||||
import './index.css';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity } from '@accord/types';
|
||||
import { getChannel, getChannelByName } from '../store/channels';
|
||||
import { getUser, getUserByTag } from '../store/users';
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { PermissionTypes } from '@accord/types/permission.types';
|
||||
import { Entity } from '@accord/types';
|
||||
import { PermissionTypes } from '@accord/types/permissions';
|
||||
import { getChannel } from '../store/channels';
|
||||
import { getGuild, getGuildRoles } from '../store/guilds';
|
||||
import { getMember, getSelfMember } from '../store/members';
|
||||
|
@ -49,7 +49,7 @@ ws.on('VOICE_DATA', async ({ channelId, connections }) => {
|
||||
for (const { blob: arrayBuffer, userId } of connections) {
|
||||
document.querySelector(`#voice${userId}`)?.remove();
|
||||
|
||||
const blob = new Blob([arrayBuffer], { 'type' : 'audio/ogg; codecs=opus' });
|
||||
const blob = new Blob([arrayBuffer as BlobPart], { 'type' : 'audio/ogg; codecs=opus' });
|
||||
const audio = document.createElement('audio');
|
||||
audio.id = `voice${userId}`;
|
||||
audio.src = window.URL.createObjectURL(blob);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import '@accord/types';
|
||||
import { WS } from '@accord/types';
|
||||
import io from 'socket.io-client';
|
||||
|
||||
const ws = (io as any).connect(process.env.REACT_APP_ROOT_API_URL, {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { REST } from '@accord/types';
|
||||
import { actions as api } from '../api';
|
||||
import { actions as channelActions } from '../channels';
|
||||
import { actions as guildActions } from '../guilds';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { REST, WS } from '@accord/types';
|
||||
import { createAction } from '@reduxjs/toolkit';
|
||||
import { headers } from './utils/rest-headers';
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { REST, WS } from '@accord/types';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import { actions as api } from './api';
|
||||
import { openDialog } from './ui';
|
||||
import { headers, token } from './utils/rest-headers';
|
||||
import { token } from './utils/rest-headers';
|
||||
|
||||
const slice = createSlice({
|
||||
name: 'auth',
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity, WS, ChannelTypes } from '@accord/types';
|
||||
import { createSelector, createSlice } from '@reduxjs/toolkit';
|
||||
import { actions as api } from './api';
|
||||
import { notInArray } from './utils/filter';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity, WS, REST } from '@accord/types';
|
||||
import { createSelector, createSlice } from '@reduxjs/toolkit';
|
||||
import { byAscending } from '../components/utils/vanilla/sort';
|
||||
import { actions as api, uploadFile } from './api';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity, WS } from '@accord/types';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import { actions as api } from './api';
|
||||
import { notInArray } from './utils/filter';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity, WS } from '@accord/types';
|
||||
import { createSelector, createSlice } from '@reduxjs/toolkit';
|
||||
import { actions as api } from './api';
|
||||
import { notInArray } from './utils/filter';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { REST, WS, Entity } from '@accord/types';
|
||||
import { createSlice, createSelector } from '@reduxjs/toolkit';
|
||||
import { actions as api, uploadFile } from './api';
|
||||
import { notInArray } from './utils/filter';
|
||||
|
@ -2,6 +2,7 @@ import { createSelector, createSlice } from '@reduxjs/toolkit';
|
||||
import { notInArray } from './utils/filter';
|
||||
import { actions as api } from './api';
|
||||
import { byMax } from './utils/reduce';
|
||||
import { Entity, WS } from '@accord/types';
|
||||
|
||||
const slice = createSlice({
|
||||
name: 'roles',
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { createSelector, createSlice } from '@reduxjs/toolkit';
|
||||
import events from '../services/event-service';
|
||||
import React from 'react';
|
||||
import { Entity } from '@accord/types';
|
||||
|
||||
const slice = createSlice({
|
||||
name: 'ui',
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Entity, WS, REST } from '@accord/types';
|
||||
import { createSlice, createSelector } from '@reduxjs/toolkit';
|
||||
import { actions as api, uploadFile } from './api';
|
||||
import { actions as meta } from './meta';
|
||||
|
@ -1,4 +1,4 @@
|
||||
export namespace Auth {
|
||||
export declare namespace Auth {
|
||||
export interface Credentials {
|
||||
email?: string;
|
||||
password: string;
|
5
frontend/src/types/main.ts
Normal file
5
frontend/src/types/main.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export * from './auth.types';
|
||||
export * from './entity.types';
|
||||
export * from './rest.types';
|
||||
export * from './util.types';
|
||||
export * from './ws.types';
|
@ -1,4 +1,4 @@
|
||||
import { Entity } from './entity';
|
||||
import { Entity } from './entity.types';
|
||||
|
||||
export namespace REST {
|
||||
export namespace To {
|
3
frontend/src/types/util.d.ts
vendored
3
frontend/src/types/util.d.ts
vendored
@ -1,3 +0,0 @@
|
||||
export module Util {
|
||||
export interface Dictionary { [k: string]: string };
|
||||
}
|
3
frontend/src/types/util.types.ts
Normal file
3
frontend/src/types/util.types.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export declare namespace Util {
|
||||
export interface Dictionary { [k: string]: string }
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import { Entity, ChannelTypes, InviteTypes, MessageTypes, UserTypes } from './entity';
|
||||
import { Entity, ChannelTypes, InviteTypes, MessageTypes, UserTypes } from './entity.types';
|
||||
|
||||
export namespace WS {
|
||||
export declare namespace WS {
|
||||
export interface To {
|
||||
/** Create a channel in a guild. */
|
||||
'CHANNEL_CREATE': Params.ChannelCreate;
|
3
frontend/types/store.d.ts
vendored
3
frontend/types/store.d.ts
vendored
@ -1,6 +1,3 @@
|
||||
import { Entity, UserTypes } from '@accord/types/entity';
|
||||
import { WS } from '@accord/types/ws';
|
||||
|
||||
declare namespace Store {
|
||||
export interface AppState {
|
||||
auth: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user