Javascript code fails to compile, but compiles with a preexisting ng serve
#11689
Labels
area: devkit/build-angular
freq1: low
Only reported by a handful of users who observe it rarely
needs: investigation
Requires some digging to determine if action is needed
severity1: confusing
type: bug/fix
Milestone
Bug Report or Feature Request (mark with an
x
)Command (mark with an
x
)Versions
Windows 10.
node -- version v8.11.3
npm --version 5.6.0
`ng --version
Angular CLI: 6.0.8
Node: 8.11.3
OS: win32 x64
Angular: 6.0.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cli 6.0.8
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.2.2
typescript 2.7.2
webpack 4.8.3
`
Repro steps
select
element:let dropdown = document.getElementById("filter-selection"); selectedFilter = dropdown.options[dropdown.selectedIndex].value;
ng serve
. It will fail to compile.ng serve
. It will compile. Leaveng serve
active.The log given by the failure
i 「wdm」: Compiled successfully. ERROR in src/app/my-component/my-component.component.ts(21,35): error TS2339: Property 'options' does not exist on type 'HTMLElement'. src/app/my-component/my-component.component.ts(21,52): error TS2339: Property 'selectedIndex' does not exist on type 'HTMLElement'.
Desired functionality
The cli should notice the failed code and not allow it to compile with the change.
Mention any other details that might be useful
Please view the SO post found here.
The text was updated successfully, but these errors were encountered: