2017-10-25 14 views
0

これは私がVisual Studio 2017で取得したエラーですが、これでいくつかの箇所で失敗してしまいます。コードに何もしなかった - それをテンプレートから取り出した。エラーがエラーで設定(赤その下の波線)である。この場合asp.net core AureliaプロジェクトのTypescript - パラメータXXXは暗黙的に 'any'型のエラーを持っています

export function configure(aurelia: Aurelia) { 
aurelia.use 
    .standardConfiguration() 
    .plugin('aurelia-api', config => { 
     config.registerEndpoint('weather', 'api/SampleData/WeatherForecasts'); 

     if (IS_DEV_BUILD) { 
      aurelia.use.developmentLogging(); 
     } 

     new HttpClient().configure(config => { 
      const baseUrl = document.getElementsByTagName("base")[0].href; 
      config.withBaseUrl(baseUrl); 
     }); 

     aurelia 
      .start() 
      .then(() => aurelia.setRoot(PLATFORM.moduleName("app/app/app"))); 
    } 
    } 

Error TS7006 (TS) Parameter 'config' implicitly has an 'any' type.

ここで別の:

 import { inject } from "aurelia-framework"; 
     import {Rest} from 'aurelia-api'; 

     @inject(Rest) 
     export class WeatherForcasts { 
      constructor (restClient) { 
      restClient.find('product', { 
       category: 5, 
       name : {contains: 'mouse'} 
       }) 
       .then(console.log) 
       .catch(console.error); 
      } 
     } 
ここ

は一例で

同じエラー - 今回は赤い線が「restClient」パラメータの下にあります:

Error TS7006 (TS) Parameter 'restClient' implicitly has an 'any' type.

なぜこのエラーが発生し、どのように修正できますか?

答えて

1

変数の型が指定されていないため、これらのエラーが発生します。理想的には、型をどこにでも追加するか、anyを明示的に指定する必要があります。

しかし、あなたはまた、これらのエラーを回避するために、あなたのts.configファイルにこのオプションを追加することができます。

"compilerOptions": { 
    "noImplicitAny": false 
} 
関連する問題