Skip to content

Commit

Permalink
Use non-null assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Apr 11, 2019
1 parent efcbc8e commit 44c7d51
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/src/pages/demos/selects/NativeSelects.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function NativeSelects() {
const inputLabel = React.useRef(null);
const [labelWidth, setLabelWidth] = React.useState(0);
React.useEffect(() => {
setLabelWidth(inputLabel.current ? inputLabel.current.offsetWidth : 0);
setLabelWidth(inputLabel.current.offsetWidth);
}, []);

const handleChange = name => event => {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/selects/NativeSelects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function NativeSelects() {
const inputLabel = React.useRef<HTMLLabelElement>(null);
const [labelWidth, setLabelWidth] = React.useState(0);
React.useEffect(() => {
setLabelWidth(inputLabel.current ? inputLabel.current.offsetWidth : 0);
setLabelWidth(inputLabel.current!.offsetWidth);
}, []);

const handleChange = (name: keyof typeof state) => (
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/selects/SimpleSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function SimpleSelect() {
const inputLabel = React.useRef(null);
const [labelWidth, setLabelWidth] = React.useState(0);
React.useEffect(() => {
setLabelWidth(inputLabel.current ? inputLabel.current.offsetWidth : 0);
setLabelWidth(inputLabel.current.offsetWidth);
}, []);

function handleChange(event) {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/selects/SimpleSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function SimpleSelect() {
const inputLabel = React.useRef<HTMLLabelElement>(null);
const [labelWidth, setLabelWidth] = React.useState(0);
React.useEffect(() => {
setLabelWidth(inputLabel.current ? inputLabel.current.offsetWidth : 0);
setLabelWidth(inputLabel.current!.offsetWidth);
}, []);

function handleChange(event: React.ChangeEvent<{ name?: string; value: unknown }>) {
Expand Down

0 comments on commit 44c7d51

Please sign in to comment.