mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add noCheck API option (#57934)
This commit is contained in:
@@ -8797,6 +8797,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
|
||||
function serializeSymbol(symbol: Symbol, isPrivate: boolean, propertyAsAlias: boolean): void {
|
||||
void getPropertiesOfType(getTypeOfSymbol(symbol)); // resolve symbol's type and properties, which should trigger any required merges
|
||||
// cache visited list based on merged symbol, since we want to use the unmerged top-level symbol, but
|
||||
// still skip reserializing it if we encounter the merged product later on
|
||||
const visitedSym = getMergedSymbol(symbol);
|
||||
@@ -48893,6 +48894,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
if (!sym) {
|
||||
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker);
|
||||
}
|
||||
resolveExternalModuleSymbol(sym); // ensures cjs export assignment is setup
|
||||
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
|
||||
},
|
||||
isImportRequiredByAugmentation,
|
||||
|
||||
@@ -772,6 +772,20 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
|
||||
defaultValueDescription: false,
|
||||
description: Diagnostics.Disable_emitting_comments,
|
||||
},
|
||||
{
|
||||
name: "noCheck",
|
||||
type: "boolean",
|
||||
showInSimplifiedHelpView: false,
|
||||
category: Diagnostics.Compiler_Diagnostics,
|
||||
description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
|
||||
transpileOptionValue: undefined,
|
||||
defaultValueDescription: false,
|
||||
affectsSemanticDiagnostics: true,
|
||||
affectsBuildInfo: true,
|
||||
extraValidation() {
|
||||
return [Diagnostics.Unknown_compiler_option_0, "noCheck"];
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "noEmit",
|
||||
type: "boolean",
|
||||
|
||||
@@ -6388,6 +6388,10 @@
|
||||
"category": "Message",
|
||||
"code": 6804
|
||||
},
|
||||
"Disable full type checking (only critical parse and emit errors will be reported).": {
|
||||
"category": "Message",
|
||||
"code": 6805
|
||||
},
|
||||
|
||||
"one of:": {
|
||||
"category": "Message",
|
||||
|
||||
@@ -848,8 +848,8 @@ export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFi
|
||||
const filesForEmit = forceDtsEmit ? sourceFiles : filter(sourceFiles, isSourceFileNotJson);
|
||||
// Setup and perform the transformation to retrieve declarations from the input files
|
||||
const inputListOrBundle = compilerOptions.outFile ? [factory.createBundle(filesForEmit)] : filesForEmit;
|
||||
if (emitOnly && !getEmitDeclarations(compilerOptions)) {
|
||||
// Checker wont collect the linked aliases since thats only done when declaration is enabled.
|
||||
if ((emitOnly && !getEmitDeclarations(compilerOptions)) || compilerOptions.noCheck) {
|
||||
// Checker wont collect the linked aliases since thats only done when declaration is enabled and checking is performed.
|
||||
// Do that here when emitting only dts files
|
||||
filesForEmit.forEach(collectLinkedAliases);
|
||||
}
|
||||
|
||||
@@ -4425,6 +4425,15 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
|
||||
}
|
||||
}
|
||||
|
||||
if (options.noCheck) {
|
||||
if (options.noEmit) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
|
||||
}
|
||||
if (!options.emitDeclarationOnly) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "noCheck", "emitDeclarationOnly");
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
options.emitDecoratorMetadata &&
|
||||
!options.experimentalDecorators
|
||||
|
||||
@@ -7270,6 +7270,7 @@ export interface CompilerOptions {
|
||||
moduleDetection?: ModuleDetectionKind;
|
||||
newLine?: NewLineKind;
|
||||
noEmit?: boolean;
|
||||
/** @internal */ noCheck?: boolean;
|
||||
/** @internal */ noEmitForJsFiles?: boolean;
|
||||
noEmitHelpers?: boolean;
|
||||
noEmitOnError?: boolean;
|
||||
|
||||
@@ -9967,6 +9967,7 @@ export function skipTypeChecking(sourceFile: SourceFile, options: CompilerOption
|
||||
// '/// <reference no-default-lib="true"/>' directive.
|
||||
return (options.skipLibCheck && sourceFile.isDeclarationFile ||
|
||||
options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib) ||
|
||||
options.noCheck ||
|
||||
host.isSourceOfProjectReferenceRedirect(sourceFile.fileName);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user