interface: fix tsc

This commit is contained in:
Matilde Park 2021-07-07 12:43:30 -04:00
parent 2412564aa7
commit e66d086c0d
8 changed files with 19 additions and 16 deletions

View File

@ -1,5 +1,5 @@
import { Action, Anchor, Box, Col, Icon, Row, Rule, Text } from '@tlon/indigo-react';
import { Association, GraphNode, Group, markEachAsRead, removePosts, TextContent, UrlContent } from '@urbit/api';
import { Association, GraphNode, Group, markEachAsRead, removePosts, TextContent, UrlContent, ReferenceContent } from '@urbit/api';
import React, { ReactElement, RefObject, useCallback, useEffect, useRef } from 'react';
import { Link, Redirect } from 'react-router-dom';
import { roleForShip } from '~/logic/lib/group';
@ -131,7 +131,7 @@ export const LinkItem = React.forwardRef((props: LinkItemProps, ref: RefObject<H
{ 'reference' in contents[1] ? (
<>
<Rule />
<PermalinkEmbed full link={referenceToPermalink(contents[1]).link} transcluded={0} />
<PermalinkEmbed full link={referenceToPermalink(contents[1] as unknown as ReferenceContent).link} transcluded={0} />
</>
) : (
<>

View File

@ -15,8 +15,8 @@ class TermApp extends Component {
store: Store;
api: any;
subscription: any;
props: any;
state: any;
declare props: any;
declare state: any;
constructor(props) {
super(props);
this.store = new Store();
@ -32,6 +32,7 @@ class TermApp extends Component {
componentDidMount() {
this.resetControllers();
// eslint-disable-next-line new-cap
const channel = new (window as any).channel();
this.api = new Api(this.props.ship, channel);
this.store.api = this.api;

View File

@ -3,7 +3,7 @@ import React, { Component } from 'react';
export class Input extends Component {
inputRef: React.RefObject<unknown>;
props: any;
declare props: any;
constructor(props) {
super(props);
this.state = {};
@ -90,9 +90,8 @@ belt = { met: 'bac' };
if (line) {
if (line.lin) {
prompt = line.lin.join('');
}
// TODO render prompt style
else if (line.klr) {
} else if (line.klr) {
// TODO render prompt style
prompt = line.klr.reduce((l, p) => (l + p.text.join('')), '');
}
}

View File

@ -140,7 +140,8 @@ function last<T>(arr: T[]) {
return arr[arr.length - 1];
}
function getChildren<T extends Record<string, unknown>>(node: T): AstContent[] {
function getChildren<T extends unknown>(node: T): AstContent[] {
// @ts-ignore TODO @liam-fitzgerald
if ('children' in node) {
// @ts-ignore TODO @liam-fitzgerald
return node.children;

View File

@ -1,5 +1,5 @@
import { Box, Col, Text } from '@tlon/indigo-react';
import { Association, groupifyGraph } from '@urbit/api';
import { Association, groupifyGraph, AppName } from '@urbit/api';
import { Form, Formik, FormikHelpers } from 'formik';
import React from 'react';
import { useHistory } from 'react-router-dom';
@ -38,7 +38,7 @@ export function GroupifyForm(props: GroupifyFormProps) {
));
let mod = association['app-name'];
if (association?.metadata?.config && 'graph' in association.metadata.config) {
mod = association.metadata.config.graph;
mod = association.metadata.config.graph as AppName;
}
const newGroup = values.group || association.group;
history.push(`/~landscape${newGroup}/resource/${mod}${rid}`);

View File

@ -1,4 +1,5 @@
import { Association } from '@urbit/api/metadata';
import { AppName } from '@urbit/api';
import React, { ReactElement } from 'react';
import Helmet from 'react-helmet';
import { Route, Switch } from 'react-router-dom';
@ -27,7 +28,7 @@ export function Resource(props: ResourceProps): ReactElement {
const contacts = useContactState(state => state.contacts);
let app = association['app-name'];
if (association?.metadata?.config && 'graph' in association.metadata.config) {
app = association.metadata.config.graph;
app = association.metadata.config.graph as AppName;
}
const { resource: rid, group: selectedGroup } = association;
const relativePath = (p: string) => `${props.baseUrl}/resource/${app}${rid}${p}`;

View File

@ -1,6 +1,7 @@
import _ from 'lodash';
import { Box, Col, Icon, Text } from '@tlon/indigo-react';
import { Association } from '@urbit/api/metadata';
import { AppName } from '@urbit/api';
import React, { ReactElement, ReactNode, useCallback, useState } from 'react';
import { Link } from 'react-router-dom';
import styled from 'styled-components';
@ -66,7 +67,7 @@ export function ResourceSkeleton(props: ResourceSkeletonProps): ReactElement {
const { association, baseUrl, children } = props;
let app = association['app-name'];
if (association?.metadata?.config && 'graph' in association.metadata.config) {
app = association.metadata.config.graph;
app = association.metadata.config.graph as AppName;
}
const rid = association.resource;
const groups = useGroupState(state => state.groups);

View File

@ -2,7 +2,7 @@ import _ from 'lodash';
import React, { useRef, ReactNode } from 'react';
import urbitOb from 'urbit-ob';
import { Icon, Row, Box, Text, BaseImage } from '@tlon/indigo-react';
import { Association, cite } from '@urbit/api';
import { Association, cite, AppName } from '@urbit/api';
import { HoverBoxLink } from '~/views/components/HoverBox';
import { Sigil } from '~/logic/lib/sigil';
import { useTutorialModal } from '~/views/components/useTutorialModal';
@ -178,7 +178,7 @@ export const SidebarAssociationItem = React.memo((props: {
const appName = association?.['app-name'];
let mod = appName;
if (association?.metadata?.config && 'graph' in association.metadata.config) {
mod = association.metadata.config.graph;
mod = association.metadata.config.graph as AppName;
}
const rid = association?.resource;
const groupPath = association?.group;
@ -270,7 +270,7 @@ export const SidebarAssociationItem = React.memo((props: {
<Icon
display="block"
color={isSynced ? 'black' : 'lightGray'}
icon={getModuleIcon(mod)}
icon={getModuleIcon(mod as any)}
/>
)}
</SidebarItemBase>