Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
5a7b7838
Commit
5a7b7838
authored
Mar 17, 2023
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace obsolete `notNull` helper with `!` operator
parent
c8c1e6fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
19 deletions
+6
-19
ShareAnnotationsPanel.tsx
src/sidebar/components/ShareAnnotationsPanel.tsx
+5
-6
thread.ts
src/sidebar/helpers/thread.ts
+1
-2
typing.js
src/sidebar/util/typing.js
+0
-11
No files found.
src/sidebar/components/ShareAnnotationsPanel.tsx
View file @
5a7b7838
...
...
@@ -12,7 +12,6 @@ import { withServices } from '../service-context';
import
type
{
ToastMessengerService
}
from
'../services/toast-messenger'
;
import
{
useSidebarStore
}
from
'../store'
;
import
{
copyText
}
from
'../util/copy-to-clipboard'
;
import
{
notNull
}
from
'../util/typing'
;
import
ShareLinks
from
'./ShareLinks'
;
import
SidebarPanel
from
'./SidebarPanel'
;
...
...
@@ -68,7 +67,7 @@ function ShareAnnotationsPanel({ toastMessenger }: ShareAnnotationPanelProps) {
className=
"text-color-text font-medium"
data
-
testid=
"sharing-intro"
>
{
notNull
(
focusedGroup
)
.
type
===
'private'
?
(
{
focusedGroup
!
.
type
===
'private'
?
(
<
p
>
Use this link to share these annotations with other group
members:
...
...
@@ -94,16 +93,16 @@ function ShareAnnotationsPanel({ toastMessenger }: ShareAnnotationPanelProps) {
</
InputGroup
>
</
div
>
<
p
data
-
testid=
"sharing-details"
>
{
notNull
(
focusedGroup
)
.
type
===
'private'
?
(
{
focusedGroup
!
.
type
===
'private'
?
(
<
span
>
Annotations in the private group
{
' '
}
<
em
>
{
notNull
(
focusedGroup
).
name
}
</
em
>
are only visible to
group
members.
<
em
>
{
focusedGroup
.
name
}
</
em
>
are only visible to group
members.
</
span
>
)
:
(
<
span
>
Anyone using this link may view the annotations in the group
{
' '
}
<
em
>
{
notNull
(
focusedGroup
)
.
name
}
</
em
>
.
<
em
>
{
focusedGroup
.
name
}
</
em
>
.
</
span
>
)
}{
' '
}
<
span
>
...
...
src/sidebar/helpers/thread.ts
View file @
5a7b7838
import
type
{
Annotation
}
from
'../../types/api'
;
import
{
notNull
}
from
'../util/typing'
;
import
type
{
Thread
}
from
'./build-thread'
;
/**
...
...
@@ -63,7 +62,7 @@ export function rootAnnotations(threads: Thread[]): Annotation[] {
// those annotations
const
threadAnnotations
=
threads
.
filter
(
thread
=>
!!
thread
.
annotation
)
.
map
(
thread
=>
notNull
(
thread
.
annotation
)
);
.
map
(
thread
=>
thread
.
annotation
!
);
if
(
threadAnnotations
.
length
)
{
return
threadAnnotations
;
...
...
src/sidebar/util/typing.js
deleted
100644 → 0
View file @
c8c1e6fd
/**
* Helper function for cases in which logically a reference is definitely
* not nullish, but TS can't infer that correctly. This will cast the `arg`
* and appease type-checking.
*
* @template T
* @param {T} arg
*/
export
function
notNull
(
arg
)
{
return
/** @type {NonNullable<T>} */
(
arg
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment