Skip to content

Commit

Permalink
[TypeScript] Convert InfoPanel.js to TypeScript (#8944)
Browse files Browse the repository at this point in the history
This converts the InfoPanel component from JavaScript
to TypeScript in order to make it easier to import/type check
in TS (without affecting the ability to load it in JS.)

(The component is small enough that this is easier than
writing a .d.ts file and keeping it in sync.)
  • Loading branch information
driusan authored Nov 13, 2023
1 parent 91837dc commit 43d2070
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions jsx/InfoPanel.js → jsx/InfoPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import PropTypes from 'prop-types';
import {ReactNode} from 'react';

/**
* Display a message in an information panel.
*
* @param {object} props - React props
* @return {JSX}
* @returns {ReactNode} - the InfoPanel
*/
function InfoPanel(props) {
function InfoPanel(props: {children: ReactNode}): ReactNode {
return (
<div className="alert alert-info"
style={{
Expand All @@ -30,8 +31,5 @@ function InfoPanel(props) {
</div>
);
}
InfoPanel.propTypes = {
children: PropTypes.node,
};

export default InfoPanel;

0 comments on commit 43d2070

Please # to comment.