coerce number type instead of modifying add utility
MODIFY
packages/@romejs/core/master/fs/MemoryFileSystem.ts
packages/@romejs/core/master/fs/MemoryFileSystem.ts
@@ -97,7 +97,8 @@ function isValidManifest(path: AbsoluteFilePath): boolean {
// Scoped module
if (segments[segments.length - 4] === 'node_modules' &&
- segments[segments.length - 3].startsWith('@')) {
+ segments[segments.length -
+ 3].startsWith('@')) {
return true;
}

MODIFY
packages/@romejs/js-parser-utils/regex.ts
packages/@romejs/js-parser-utils/regex.ts
@@ -12,8 +12,10 @@ const VALID_REGEX_FLAGS: Array<string> = 'gmsiyu'.split('');
// This is used by both rome-json and rome-js-parser to validate regex flags
export function validateRegexFlags(
flags: string,
+ parserIndex: number,
onUnexpected: (
metadata: Omit<DiagnosticDescription, 'category'>,
+ parserIndex: number,
index: number,
) => void,
): Set<

MODIFY
packages/@romejs/js-parser/tokenizer/index.ts
packages/@romejs/js-parser/tokenizer/index.ts
@@ -1029,11 +1029,11 @@ export function readRegexp(parser: JSParser): void {
}
const mods = validateRegexFlags(rawMods, getIndex(parser), (
metadata,
- parserIndex
+ parserIndex,
flagPosition,
) => {
parser.addDiagnostic({
- index: add(parserIndex - rawMods.length, flagPosition),
+ index: add(coerce0(parserIndex - rawMods.length), flagPosition),
description: metadata,
});
});

MODIFY
packages/@romejs/ob1/index.ts
packages/@romejs/ob1/index.ts
@@ -28,7 +28,6 @@ export function add(a: number, b: Number0): Number0;
export function add(a: Number1, b: Number0): Number1;
export function add(a: Number0, b: Number1): Number1;
export function add(a: Number0, b: Number0): Number0;
-export function add(a: number, b: number): Number0;
export function add(a: number | AnyNumber, b: number | AnyNumber): AnyNumber {
// @ts-ignore
return a + b;

coerce number type instead of modifying add utility