您已更新到最新的WebStorm,我现在收到此错误:
Error:(52, 14) TS1219:Experimental support for decorators
is a feature that is subject to change in a future release.
Set the 'experimentalDecorators' option to remove this warning.
但在我的tsConfig experimentalDecorators
设置为true:
{
"version": "1.5.0",
"compilerOptions": {
//...,
"experimentalDecorators": true, // <======== HERE
//...,
},
"files": [
//...
],
"exclude": [ "node_modules" ]
}
答案 0 :(得分:19)
WS2016.3 才会将配置设置应用于文件。或者包括&#39; tsconfig.json部分。 [More info about tsconfig.json]
因此配置必须包含所有项目文件(或者如果你有几个部分的应用程序,你可以有几个tsconfig.json文件)。否则,typescript服务使用该文件的默认打字稿选项。
首选解决方案
您的 tsconfig.json 应为:
{
"version": "1.5.0",
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"noImplicitAny": false,
"removeComments": true,
"noLib": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"listFiles": true,
"isolatedModules": false,
"moduleResolution": "node",
"suppressImplicitAnyIndexErrors": true
},
"include": [
"typings/thera/thera.d.ts",
"typings/browser.d.ts",
"typings/main.d.ts",
"typings/meteor.d.ts",
"typings/meteor_server.d.ts",
"your_app_directory/**/*"
],
"exclude": [ "node_modules" ],
"compileOnSave":false //not required but is suggested for meteor projects
}
另一种解决方案
您可以在TypeScript设置中指定默认选项(如果您不想自动编译,则应取消选中track changes
选项):
注意:如果您不喜欢新行为,可以在&#34;文件|中禁用打字稿服务集成。设置|语言与框架|打字稿&#34; - &GT; &#34;使用TypeScript服务&#34;。
答案 1 :(得分:9)
答案 2 :(得分:2)
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String name= request.getParameter("name");
String description = request.getParameter("description");
String prix = request.getParameter("prix");
String image;
String chemin = getInitParameter( CHEMIN);
Part part = request.getPart("file");
String fileName =Paths.get(part.getSubmittedFileName()).getFileName().toString();
String fullPath = chemin + fileName;
if ( fileName != null && !fileName.isEmpty() ) {
fileName = fileName.substring( fileName.lastIndexOf( '/' ) + 1 )
.substring( fileName.lastIndexOf( '\\' ) + 1 );
fwrite( part, fileName, fullPath );
File srcFile = new File( fullPath );
byte [] buffer = new byte[ (int) srcFile.length() ];
try ( FileInputStream inputStream = new FileInputStream( srcFile ) ) {
inputStream.read( buffer );
}
}
image = fullPath;
manager.addBurger(name, description, prix, image);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(VUE);
dispatcher.forward(request, response);
}
点击右下角的应用按钮