Skip to content

Angular 11.2+ language service error for inline type constructor not supported by current environment (-998901) #40963

@tgfactor

Description

@tgfactor

🐞 bug report

Affected Package

@angular/compiler-cli - oob.js
@angular/language-service - ivy.js

Is this a regression?

Worked before in version 11.0.x, and I assume 11.1.x because my Visual Studio Code Extension seems to always update on the latest version of Angular language, and this just started happening in the past week.

Description

I am currently using angular-imask and iMask in my Angular 11 projects. I have not touched any aspect of the usage of these plugins in my code for the past two months, and have not had any unusual Visual Studio Code errors pop up, until now. I've started to see the following error appear in both the .ts and .html file of the affected components:

"This component uses a directive which requires an inline type constructor, which is not supported by the current environment. (-998901)"

I pinpointed it down to the imask directive I use for my input field (assume moneyMask is a valid mask object that has not been changed for the past two months):

<input type="text" id="someId" name="someName" ... [imask]="moneyMask" [unmask]="true" >

If I were to remove the [imask] and [unmask] directives from my input tag, the VSC error goes away for both the affected .ts and .html component files. But now I have effectively eliminated masking from my input fields.

Important: While this error does appear in VSC, I get no issues after running ng lint (I am using ESLint instead of TSLint), and my project both runs fine locally via ng serve and can built without any errors too. So this seems to be centralized with Visual Studio Code and the Angular Language Service, but I know at some point my development team is going to be asking questions soon about this and it could affect any other directive-based plugins I choose to use in my projects.

🌍 Your Environment

Angular Version:


Angular CLI: 11.2.1
Node: 12.20.1
OS: win32 x64

Angular: 11.2.2
... animations, common, compiler, compiler-cli, core, elements
... forms, language-service, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.1
@angular-devkit/build-angular   0.1102.1
@angular-devkit/core            11.2.1
@angular-devkit/schematics      11.2.1
@angular/cdk                    11.2.1
@angular/cli                    11.2.1
@schematics/angular             11.2.1
@schematics/update              0.1102.1
rxjs                            6.6.3
typescript                      4.1.5

Running Visual Studio Code version 1.53.2.
Angular Language Service Extension running version 11.2.3

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilerarea: language-serviceIssues related to Angular's VS Code language service

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions