Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/455.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 获取:错误TS1128:需要声明或语句。在中国,;打字脚本应用程序_Javascript_Reactjs_Typescript - Fatal编程技术网

Javascript 获取:错误TS1128:需要声明或语句。在中国,;打字脚本应用程序

Javascript 获取:错误TS1128:需要声明或语句。在中国,;打字脚本应用程序,javascript,reactjs,typescript,Javascript,Reactjs,Typescript,下面是我创建的新组件的当前代码,它导致抛出此错误 未能编译 ./src/components/Hello.tsx (5,1):错误TS1128:应为声明或语句 我已经检查了其他答案,还没有找到真正的问题 // src/components/Hello.tsx import * as React from 'react'; export Interface Props { name: string; enthusiasmLevel?: number; } function Hello

下面是我创建的新组件的当前代码,它导致抛出此错误

未能编译

./src/components/Hello.tsx (5,1):错误TS1128:应为声明或语句

我已经检查了其他答案,还没有找到真正的问题

// src/components/Hello.tsx

import * as React from 'react';

export Interface Props {
  name: string;
  enthusiasmLevel?: number;
}

function Hello({ name, enthusiasmLevel = 1 }: Props) {
  if (enthusiasmLevel <= 0) {
    throw new Error('You could be a little more enthusiastic. :D');
  }

  return (
    <div className="hello">
      <div className="greeting">
        Hello {name + getExclamationMarks(enthusiasmLevel)}
      </div>
    </div>
  );
}

export default Hello;

// helpers

function getExclamationMarks(numChars: number) {
  return Array(numChars + 1).join('!');
}
//src/components/Hello.tsx
从“React”导入*作为React;
导出接口道具{
名称:字符串;
热情水平?:数字;
}
函数Hello({name,entusiasmlevel=1}:Props){
if(热情水平变化

export Interface Props {


接口
-->
接口
(应该是小写的)我实际上有一个错误,要求我将其改为大写,但我刚刚意识到了错误。在我更改了tslint文件后,我忘记了重新启动纱线。我将很快关闭它,因为这不是基于逻辑的问题。
export interface Props {