MCPcopy Create free account
hub / github.com/angular/angular / buildTypeCheckingConfig

Function buildTypeCheckingConfig

packages/compiler-cli/preprocessor/src/tcb.ts:182–319  ·  view source on GitHub ↗
(
  options: NgpCompilerOptions = {},
  enableTemplateTypeChecker: boolean = false,
  usePoisonedData = false,
)

Source from the content-addressed store, hash-verified

180}
181
182export function buildTypeCheckingConfig(
183 options: NgpCompilerOptions = {},
184 enableTemplateTypeChecker: boolean = false,
185 usePoisonedData = false,
186): NgpTypeCheckingConfig {
187 enableTemplateTypeChecker =
188 enableTemplateTypeChecker || Boolean(options._enableTemplateTypeChecker);
189 const strictTemplates = options.strictTemplates !== false;
190
191 let typeCheckingConfig: NgpTypeCheckingConfig;
192 if (strictTemplates) {
193 typeCheckingConfig = {
194 applyTemplateContextGuards: true,
195 checkTemplateBodies: true,
196 alwaysCheckSchemaInTemplateBodies: true,
197 checkTypeOfInputBindings: true,
198 honorAccessModifiersForInputBindings: false,
199 checkControlFlowBodies: true,
200 strictNullInputBindings: true,
201 checkTypeOfAttributes: true,
202 checkTypeOfDomBindings: false,
203 checkTypeOfOutputEvents: true,
204 checkTypeOfAnimationEvents: true,
205 checkTypeOfDomEvents: true,
206 checkTypeOfDomReferences: true,
207 checkTypeOfNonDomReferences: true,
208 checkTypeOfPipes: true,
209 strictSafeNavigationTypes: true,
210 useContextGenericType: true,
211 strictLiteralTypes: true,
212 enableTemplateTypeChecker,
213 useInlineTypeConstructors: false,
214 controlFlowPreventingContentProjection:
215 options.extendedDiagnostics?.checks?.controlFlowPreventingContentProjection ??
216 options.extendedDiagnostics?.defaultCategory ??
217 'warning',
218 unusedStandaloneImports:
219 options.unusedStandaloneImports ??
220 options.extendedDiagnostics?.checks?.unusedStandaloneImports ??
221 options.extendedDiagnostics?.defaultCategory ??
222 'warning',
223 // These are actually set via version check in ngtsc (ngtsc/core/src/compiler.ts).
224 // Since we don't have any of that here we just default to true.
225 allowSignalsInTwoWayBindings: true,
226 allowDomEventAssertion: true,
227 checkUnclaimedEventNames: false,
228 checkUnknownElements: false,
229 checkTypeOfNgTemplateBindings: false,
230 };
231 } else {
232 typeCheckingConfig = {
233 applyTemplateContextGuards: false,
234 checkTemplateBodies: false,
235 checkControlFlowBodies: false,
236 alwaysCheckSchemaInTemplateBodies: !!options.annotateForClosureCompiler,
237 checkTypeOfInputBindings: false,
238 strictNullInputBindings: false,
239 honorAccessModifiersForInputBindings: false,

Callers 14

getLanguageServiceMethod · 0.90
createProjectMethod · 0.90
createSessionFunction · 0.85
setupCompilerFunction · 0.85
setupMultiFileCompilerFunction · 0.85
runPipelineFunction · 0.85
createCompilerFunction · 0.85
createIncrementalSessionFunction · 0.85
updateFilesFunction · 0.85
updateOptionsFunction · 0.85
perf_spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected