丟失包的錯誤,我跟着/克隆這種github repo:爲什麼我即使我輸入他們在Visual Studio代碼
然後我打開Visual Studio代碼項目。我得到這個錯誤:
錯誤:
'This syntax requires an imported helper named '__decorate', but module 'tslib' has no exported member '__decorate'.' at: '13,1' source: 'ts'
'This syntax requires an imported helper named '__metadata', but module 'tslib' has no exported member '__metadata'.' at: '13,1' source: 'ts'
'Cannot find name 'OnInit'.' at: '27,41' source: 'ts'
這是源代碼:
import {
Component,
OnInit,
} from '@angular/core';
/**
* We're loading this component asynchronously
* We are using some magic with es6-promise-loader that will wrap the module with a Promise
* see https://github.com/gdi2290/es6-promise-loader for more info
*/
console.log('`Detail` component loaded asynchronously');
@Component({
selector: 'detail',
template: `
<h1>Hello from Detail</h1>
<span>
<a [routerLink]=" ['./child-detail'] ">
Child Detail
</a>
</span>
<router-outlet></router-outlet>
`,
})
export class DetailComponent implements OnInit {
public ngOnInit() {
console.log('hello `Detail` component');
}
}
附:我已重新打開Visual Studio代碼,但錯誤仍然存在。
https://github.com/AngularClass/angular-starter/issues/1819。附:回答包括實際錯誤文本在內的問題更容易,而不是截圖。 – Claies
您的進口報表在哪裏? – Aravind
@Aravind導入語句位於我在此附加的源代碼的頂部 – EntryLeveDeveloper