interface/logic/lib: ts lint

This commit is contained in:
Matilde Park 2021-05-13 18:38:10 -04:00
parent f7aab5893c
commit 60ff81e0b9
5 changed files with 8 additions and 3 deletions

View File

@ -6,13 +6,15 @@ interface IFormGroupContext {
onDirty: (id: string, touched: boolean) => void;
onErrors: (id: string, errors: boolean) => void;
submitAll: () => Promise<any>;
addReset: (id: string, r: any) => any;
}
const fallback: IFormGroupContext = {
addSubmit: () => {},
onDirty: () => {},
onErrors: () => {},
submitAll: () => Promise.resolve()
submitAll: () => Promise.resolve(),
addReset: () => {}
};
export const FormGroupContext = React.createContext(fallback);

View File

@ -89,6 +89,7 @@ export function describeNotification(notification: IndexedNotification) {
return `New comment${plural ? 's' : ''} on`;
case 'note':
return `New Note${plural ? 's' : ''} in`;
// @ts-ignore
case 'edit-note':
return `updated ${pluralize('note', plural)} in`;
case 'mention':
@ -105,6 +106,7 @@ export function describeNotification(notification: IndexedNotification) {
if('group' in notification.index) {
return group(notification.index.group);
} else if('graph' in notification.index) {
// @ts-ignore needs better type guard
const contents = notification.notification?.contents?.graph ?? [] as Post[];
return graph(notification.index.graph, contents.length > 1, _.uniq(_.map(contents, 'author')).length === 1)

View File

@ -76,7 +76,7 @@ export function editPost(rev: number, noteId: BigInteger, title: string, body: s
return nodes;
}
export function getLatestRevision(node: GraphNode): [number, string, string, Post] {
export function getLatestRevision(node: GraphNode): [number, string, any, Post] {
const empty = [1, '', '', buntPost()] as [number, string, string, Post];
const revs = node.children?.get(bigInt(1));
if(!revs) {

View File

@ -17,7 +17,7 @@ interface SetStateFunc<T> {
}
// See microsoft/typescript#37663 for filed bug
type SetState<T> = T extends any ? SetStateFunc<T> : never;
export function useLocalStorageState<T>(key: string, initial: T) {
export function useLocalStorageState<T>(key: string, initial: T): any {
const [state, _setState] = useState(() => retrieve(key, initial));
useEffect(() => {

View File

@ -458,6 +458,7 @@ export const useHovering = (): useHoveringInterface => {
export function withHovering<T>(Component: React.ComponentType<T>) {
return React.forwardRef((props, ref) => {
const { hovering, bind } = useHovering();
// @ts-ignore needs type signature on return?
return <Component ref={ref} hovering={hovering} bind={bind} {...props} />
})
}