Skip to content

Commit 21148b3

Browse files
authored
Fix typo in PseudoPragma* types (#27437)
1 parent 6d92a29 commit 21148b3

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/compiler/parser.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7725,7 +7725,7 @@ namespace ts {
77257725
/*@internal*/
77267726
export function processCommentPragmas(context: PragmaContext, sourceText: string): void {
77277727
const triviaScanner = createScanner(context.languageVersion, /*skipTrivia*/ false, LanguageVariant.Standard, sourceText);
7728-
const pragmas: PragmaPsuedoMapEntry[] = [];
7728+
const pragmas: PragmaPseudoMapEntry[] = [];
77297729

77307730
// Keep scanning all the leading trivia in the file until we get to something that
77317731
// isn't trivia. Any single line comment will be analyzed to see if it is a
@@ -7780,7 +7780,7 @@ namespace ts {
77807780
const referencedFiles = context.referencedFiles;
77817781
const typeReferenceDirectives = context.typeReferenceDirectives;
77827782
const libReferenceDirectives = context.libReferenceDirectives;
7783-
forEach(toArray(entryOrList), (arg: PragmaPsuedoMap["reference"]) => {
7783+
forEach(toArray(entryOrList), (arg: PragmaPseudoMap["reference"]) => {
77847784
// TODO: GH#18217
77857785
if (arg!.arguments["no-default-lib"]) {
77867786
context.hasNoDefaultLib = true;
@@ -7803,7 +7803,7 @@ namespace ts {
78037803
case "amd-dependency": {
78047804
context.amdDependencies = map(
78057805
toArray(entryOrList),
7806-
(x: PragmaPsuedoMap["amd-dependency"]) => ({ name: x!.arguments.name!, path: x!.arguments.path })); // TODO: GH#18217
7806+
(x: PragmaPseudoMap["amd-dependency"]) => ({ name: x!.arguments.name!, path: x!.arguments.path })); // TODO: GH#18217
78077807
break;
78087808
}
78097809
case "amd-module": {
@@ -7813,11 +7813,11 @@ namespace ts {
78137813
// TODO: It's probably fine to issue this diagnostic on all instances of the pragma
78147814
reportDiagnostic(entry!.range.pos, entry!.range.end - entry!.range.pos, Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments);
78157815
}
7816-
context.moduleName = (entry as PragmaPsuedoMap["amd-module"])!.arguments.name;
7816+
context.moduleName = (entry as PragmaPseudoMap["amd-module"])!.arguments.name;
78177817
}
78187818
}
78197819
else {
7820-
context.moduleName = (entryOrList as PragmaPsuedoMap["amd-module"])!.arguments.name;
7820+
context.moduleName = (entryOrList as PragmaPseudoMap["amd-module"])!.arguments.name;
78217821
}
78227822
break;
78237823
}
@@ -7853,10 +7853,10 @@ namespace ts {
78537853

78547854
const tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im;
78557855
const singleLinePragmaRegEx = /^\/\/\/?\s*@(\S+)\s*(.*)\s*$/im;
7856-
function extractPragmas(pragmas: PragmaPsuedoMapEntry[], range: CommentRange, text: string) {
7856+
function extractPragmas(pragmas: PragmaPseudoMapEntry[], range: CommentRange, text: string) {
78577857
const tripleSlash = range.kind === SyntaxKind.SingleLineCommentTrivia && tripleSlashXMLCommentStartRegEx.exec(text);
78587858
if (tripleSlash) {
7859-
const name = tripleSlash[1].toLowerCase() as keyof PragmaPsuedoMap; // Technically unsafe cast, but we do it so the below check to make it safe typechecks
7859+
const name = tripleSlash[1].toLowerCase() as keyof PragmaPseudoMap; // Technically unsafe cast, but we do it so the below check to make it safe typechecks
78607860
const pragma = commentPragmas[name] as PragmaDefinition;
78617861
if (!pragma || !(pragma.kind! & PragmaKindFlags.TripleSlashXML)) {
78627862
return;
@@ -7883,10 +7883,10 @@ namespace ts {
78837883
}
78847884
}
78857885
}
7886-
pragmas.push({ name, args: { arguments: argument, range } } as PragmaPsuedoMapEntry);
7886+
pragmas.push({ name, args: { arguments: argument, range } } as PragmaPseudoMapEntry);
78877887
}
78887888
else {
7889-
pragmas.push({ name, args: { arguments: {}, range } } as PragmaPsuedoMapEntry);
7889+
pragmas.push({ name, args: { arguments: {}, range } } as PragmaPseudoMapEntry);
78907890
}
78917891
return;
78927892
}
@@ -7905,17 +7905,17 @@ namespace ts {
79057905
}
79067906
}
79077907

7908-
function addPragmaForMatch(pragmas: PragmaPsuedoMapEntry[], range: CommentRange, kind: PragmaKindFlags, match: RegExpExecArray) {
7908+
function addPragmaForMatch(pragmas: PragmaPseudoMapEntry[], range: CommentRange, kind: PragmaKindFlags, match: RegExpExecArray) {
79097909
if (!match) return;
7910-
const name = match[1].toLowerCase() as keyof PragmaPsuedoMap; // Technically unsafe cast, but we do it so they below check to make it safe typechecks
7910+
const name = match[1].toLowerCase() as keyof PragmaPseudoMap; // Technically unsafe cast, but we do it so they below check to make it safe typechecks
79117911
const pragma = commentPragmas[name] as PragmaDefinition;
79127912
if (!pragma || !(pragma.kind! & kind)) {
79137913
return;
79147914
}
79157915
const args = match[2]; // Split on spaces and match up positionally with definition
79167916
const argument = getNamedPragmaArguments(pragma, args);
79177917
if (argument === "fail") return; // Missing required argument, fail to parse it
7918-
pragmas.push({ name, args: { arguments: argument, range } } as PragmaPsuedoMapEntry);
7918+
pragmas.push({ name, args: { arguments: argument, range } } as PragmaPseudoMapEntry);
79197919
return;
79207920
}
79217921

src/compiler/types.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5616,15 +5616,15 @@ namespace ts {
56165616
type ConcretePragmaSpecs = typeof commentPragmas;
56175617

56185618
/* @internal */
5619-
export type PragmaPsuedoMap = {[K in keyof ConcretePragmaSpecs]?: {arguments: PragmaArgumentType<ConcretePragmaSpecs[K]>, range: CommentRange}};
5619+
export type PragmaPseudoMap = {[K in keyof ConcretePragmaSpecs]?: {arguments: PragmaArgumentType<ConcretePragmaSpecs[K]>, range: CommentRange}};
56205620

56215621
/* @internal */
5622-
export type PragmaPsuedoMapEntry = {[K in keyof PragmaPsuedoMap]: {name: K, args: PragmaPsuedoMap[K]}}[keyof PragmaPsuedoMap];
5622+
export type PragmaPseudoMapEntry = {[K in keyof PragmaPseudoMap]: {name: K, args: PragmaPseudoMap[K]}}[keyof PragmaPseudoMap];
56235623

56245624
/* @internal */
5625-
export interface ReadonlyPragmaMap extends ReadonlyMap<PragmaPsuedoMap[keyof PragmaPsuedoMap] | PragmaPsuedoMap[keyof PragmaPsuedoMap][]> {
5626-
get<TKey extends keyof PragmaPsuedoMap>(key: TKey): PragmaPsuedoMap[TKey] | PragmaPsuedoMap[TKey][];
5627-
forEach(action: <TKey extends keyof PragmaPsuedoMap>(value: PragmaPsuedoMap[TKey] | PragmaPsuedoMap[TKey][], key: TKey) => void): void;
5625+
export interface ReadonlyPragmaMap extends ReadonlyMap<PragmaPseudoMap[keyof PragmaPseudoMap] | PragmaPseudoMap[keyof PragmaPseudoMap][]> {
5626+
get<TKey extends keyof PragmaPseudoMap>(key: TKey): PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][];
5627+
forEach(action: <TKey extends keyof PragmaPseudoMap>(value: PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][], key: TKey) => void): void;
56285628
}
56295629

56305630
/**
@@ -5633,10 +5633,10 @@ namespace ts {
56335633
* in multiple places
56345634
*/
56355635
/* @internal */
5636-
export interface PragmaMap extends Map<PragmaPsuedoMap[keyof PragmaPsuedoMap] | PragmaPsuedoMap[keyof PragmaPsuedoMap][]>, ReadonlyPragmaMap {
5637-
set<TKey extends keyof PragmaPsuedoMap>(key: TKey, value: PragmaPsuedoMap[TKey] | PragmaPsuedoMap[TKey][]): this;
5638-
get<TKey extends keyof PragmaPsuedoMap>(key: TKey): PragmaPsuedoMap[TKey] | PragmaPsuedoMap[TKey][];
5639-
forEach(action: <TKey extends keyof PragmaPsuedoMap>(value: PragmaPsuedoMap[TKey] | PragmaPsuedoMap[TKey][], key: TKey) => void): void;
5636+
export interface PragmaMap extends Map<PragmaPseudoMap[keyof PragmaPseudoMap] | PragmaPseudoMap[keyof PragmaPseudoMap][]>, ReadonlyPragmaMap {
5637+
set<TKey extends keyof PragmaPseudoMap>(key: TKey, value: PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][]): this;
5638+
get<TKey extends keyof PragmaPseudoMap>(key: TKey): PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][];
5639+
forEach(action: <TKey extends keyof PragmaPseudoMap>(value: PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][], key: TKey) => void): void;
56405640
}
56415641

56425642
export interface UserPreferences {

0 commit comments

Comments
 (0)