Improve typings
This commit is contained in:
@@ -9,17 +9,17 @@ import { Spinner } from '@wordpress/components';
|
||||
import { baseUrl } from '@/globals';
|
||||
import { ReactComponent as CogIcon } from '@/assets/cogicon.svg';
|
||||
|
||||
type PreviewProps = {
|
||||
interface IPreviewProps {
|
||||
embedCode: string;
|
||||
};
|
||||
}
|
||||
|
||||
type PreviewState = {
|
||||
interface IPreviewState {
|
||||
uniqueId: string;
|
||||
loading: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
class PreviewForm extends React.Component<PreviewProps, PreviewState> {
|
||||
constructor( props: any ) {
|
||||
class PreviewForm extends React.Component<IPreviewProps, IPreviewState> {
|
||||
constructor( props: IPreviewProps ) {
|
||||
super( props );
|
||||
|
||||
// Generate a unique identifier, so that the embed script can be identified
|
||||
@@ -39,7 +39,7 @@ class PreviewForm extends React.Component<PreviewProps, PreviewState> {
|
||||
}
|
||||
|
||||
// Force the embed script to load, which makes Iframes in the editor resize properly.
|
||||
loadEmbedScript( callback?: Function ) {
|
||||
loadEmbedScript( callback?: () => void ) {
|
||||
const existingScript = document.getElementById( `cog-embed-script-${ this.state.uniqueId }` );
|
||||
|
||||
if ( ! existingScript ) {
|
||||
|
@@ -5,16 +5,14 @@ import * as React from 'react';
|
||||
import { Modal, FocusableIframe } from '@wordpress/components';
|
||||
|
||||
import { baseUrl } from '@/globals';
|
||||
import { IForm } from '@/types';
|
||||
|
||||
interface IDialogProps {
|
||||
setOpen: Function;
|
||||
onSelectForm: Function;
|
||||
setOpen: ( val: boolean ) => void;
|
||||
onSelectForm: ( form: IForm ) => void;
|
||||
}
|
||||
|
||||
interface IDialogState {
|
||||
}
|
||||
|
||||
class SelectDialog extends React.Component<IDialogProps, IDialogState> {
|
||||
class SelectDialog extends React.Component<IDialogProps> {
|
||||
componentDidMount() {
|
||||
window.addEventListener( 'message', this.handlePostMessage, false );
|
||||
}
|
||||
|
Reference in New Issue
Block a user