aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vnext/src/App.js7
-rw-r--r--vnext/src/ui/Feeds.js6
-rw-r--r--vnext/src/ui/Login.js2
-rw-r--r--vnext/src/ui/Message.js3
-rw-r--r--vnext/src/ui/MessageInput.js6
-rw-r--r--vnext/src/ui/Post.js2
-rw-r--r--vnext/src/ui/Settings.js4
-rw-r--r--vnext/src/ui/UserInfo.js2
8 files changed, 18 insertions, 14 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js
index 4251d52c..3479ad4f 100644
--- a/vnext/src/App.js
+++ b/vnext/src/App.js
@@ -97,7 +97,8 @@ export default function App() {
});
}, [x, y, setScrollState]);
const [hash, setHash] = useState(cookie.load('hash'));
- const [eventSource, setEventSource] = useState({});
+
+ const [eventSource, setEventSource] = /** @param EventSource? */ useState(null);
useEffect(() => {
let es;
@@ -176,10 +177,10 @@ export default function App() {
<Chat connection={eventSource} visitor={visitor} />
</Route>
<Route exact path="/:user/friends">
- <Friends visitor={visitor} />
+ <Friends />
</Route>
<Route exact path="/:user/readers">
- <Readers visitor={visitor} />
+ <Readers />
</Route>
<Route exact path="/:user">
<Blog visitor={visitor} />
diff --git a/vnext/src/ui/Feeds.js b/vnext/src/ui/Feeds.js
index 27a8376f..9bbecf89 100644
--- a/vnext/src/ui/Feeds.js
+++ b/vnext/src/ui/Feeds.js
@@ -104,9 +104,9 @@ export function Home({ visitor }) {
/**
* @typedef {Object} FeedState
- * @property authRequired?: boolean
- * @property visitor: import('../api').SecureUser
- * @property msgs: import('../api').Message[]
+ * @property { boolean } authRequired
+ * @property { import('../api').SecureUser } visitor
+ * @property { import('../api').Message[]= } msgs
* @property { Query} query
*/
diff --git a/vnext/src/ui/Login.js b/vnext/src/ui/Login.js
index 0c6f5d0c..641ceb67 100644
--- a/vnext/src/ui/Login.js
+++ b/vnext/src/ui/Login.js
@@ -13,7 +13,7 @@ import './Login.css';
/**
* @typedef {Object} LoginProps
* @property {import('../api').SecureUser} visitor
- * @property {any} onAuth
+ * @property {function} onAuth
*/
/**
diff --git a/vnext/src/ui/Message.js b/vnext/src/ui/Message.js
index 51ff12ec..83c6fcab 100644
--- a/vnext/src/ui/Message.js
+++ b/vnext/src/ui/Message.js
@@ -13,7 +13,7 @@ import './Message.css';
/**
* Message component
- * @param {{data: import('../api').Message, visitor: import('../api').User, children: Element}} props
+ * @param {{data: import('../api').Message, visitor: import('../api').User, children: React.ReactElement}} props
*/
export default function Message({ data, visitor, children }) {
const isCode = (data.tags || []).indexOf('code') >= 0;
@@ -123,6 +123,7 @@ function Tags({ data, user }) {
{
data.map(tag => {
return (<Link key={tag} to={{ pathname: `/${user.uname}`, search: `?tag=${tag}` }} title={tag}>{tag}</Link>);
+ // @ts-ignore
}).reduce((prev, curr) => [prev, ', ', curr])
}
</div>
diff --git a/vnext/src/ui/MessageInput.js b/vnext/src/ui/MessageInput.js
index e19136d4..e20d5100 100644
--- a/vnext/src/ui/MessageInput.js
+++ b/vnext/src/ui/MessageInput.js
@@ -13,8 +13,10 @@ import UploadButton from './UploadButton';
function moveCaretToEnd(el) {
if (typeof el.selectionStart == 'number') {
el.selectionStart = el.selectionEnd = el.value.length;
+ // @ts-ignore
} else if (typeof el.createTextRange != 'undefined') {
el.focus();
+ // @ts-ignore
var range = el.createTextRange();
range.collapse(false);
range.select();
@@ -24,9 +26,9 @@ function moveCaretToEnd(el) {
/**
* @typedef {Object} MessageInputProps
* @property {string} text
- * @property {import('../api').Message} data
+ * @property {import('../api').Message=} data
* @property {function} onSend
- * @property {number} rows
+ * @property {number=} rows
* @property {string} children
*/
diff --git a/vnext/src/ui/Post.js b/vnext/src/ui/Post.js
index 407f3b62..7c5c07cd 100644
--- a/vnext/src/ui/Post.js
+++ b/vnext/src/ui/Post.js
@@ -35,7 +35,7 @@ export default function Post({ visitor }) {
};
return (
<div className="msg-cont">
- <MessageInput rows="7" text={params.body || draft || ''} data={{ mid: 0, timestamp: '0' }} onSend={postMessage}>
+ <MessageInput rows={7} text={params.body || draft || ''} data={{}} onSend={postMessage}>
*weather It is very cold today!
</MessageInput>
{
diff --git a/vnext/src/ui/Settings.js b/vnext/src/ui/Settings.js
index ba0286ca..4b9dc2e9 100644
--- a/vnext/src/ui/Settings.js
+++ b/vnext/src/ui/Settings.js
@@ -8,7 +8,7 @@ import UploadButton from './UploadButton';
import Avatar from './Avatar';
/**
- * @param {{ visitor: import('../api').SecureUser, onChange: React.ChangeEvent<import('../api').SecureUser> }} props
+ * @param {{ visitor: import('../api').SecureUser, onChange: function }} props
*/
function ChangeAvatarForm({ visitor, onChange }) {
const [avatar, setAvatar] = useState('');
@@ -53,7 +53,7 @@ function ChangeAvatarForm({ visitor, onChange }) {
}
/**
- * @param {{ visitor: import('../api').SecureUser, onChange: React.ChangeEvent<import('../api').SecureUser> }} props
+ * @param {{ visitor: import('../api').SecureUser, onChange: function }} props
*/
export default function Settings({ visitor, onChange }) {
diff --git a/vnext/src/ui/UserInfo.js b/vnext/src/ui/UserInfo.js
index 00465252..0be93bb8 100644
--- a/vnext/src/ui/UserInfo.js
+++ b/vnext/src/ui/UserInfo.js
@@ -13,7 +13,7 @@ let isMounted;
/**
* User info component
- * @param {{uname: string, onUpdate?: function, children?: React.ReactHTMLElement}} props
+ * @param {{uname: string, onUpdate?: function, children?: React.ReactElement}} props
*/
export default function UserInfo({ uname, onUpdate, children }) {
const [user, setUser] = useState({