From 6ecde9590b68189ca96fd0f2afccbd60d44f5950 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 14 Nov 2019 14:32:50 +0300 Subject: Fix some jsdoc definitions --- vnext/src/App.js | 7 ++++--- vnext/src/ui/Feeds.js | 6 +++--- vnext/src/ui/Login.js | 2 +- vnext/src/ui/Message.js | 3 ++- vnext/src/ui/MessageInput.js | 6 ++++-- vnext/src/ui/Post.js | 2 +- vnext/src/ui/Settings.js | 4 ++-- vnext/src/ui/UserInfo.js | 2 +- 8 files changed, 18 insertions(+), 14 deletions(-) (limited to 'vnext/src') 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() { - + - + 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 ({tag}); + // @ts-ignore }).reduce((prev, curr) => [prev, ', ', curr]) } 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 (
- + *weather It is very cold today! { 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 }} 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 }} 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({ -- cgit v1.2.3