Js type command?

look at the plug-in source code and stumble upon this writing:
type Axis = "both" |" x" | "none";
import type {Element as ReactElement, Node as ReactNode} from" react";
what does type mean?

import React from "react";
import PropTypes from "prop-types";
import {DraggableCore} from "react-draggable";
import cloneElement from "./cloneElement";
import type {Element as ReactElement, Node as ReactNode} from "react";

type Axis = "both" | "x" | "y" | "none";
type State = {
  resizing: boolean,
  width: number, height: number,
  slackW: number, slackH: number
};
type DragCallbackData = {
  node: HTMLElement,
  x: number, y: number,
  deltaX: number, deltaY: number,
  lastX: number, lastY: number
};
export type ResizeCallbackData = {
  node: HTMLElement,
  size: {width: number, height: number}
};

//...
Apr.02,2021

as far as I know, there is no such thing as type in js. This should be the syntax on top of js


this is a type alias for flow. For more information, please see https://flow.org/en/docs/type.

Menu