mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-12 11:50:54 -06:00
Fix incorrect relative module name detection (#19702)
This commit is contained in:
parent
d54ad4b01a
commit
1e89e78dd2
@ -64,7 +64,6 @@ module Commands {
|
||||
}
|
||||
if (path.charAt(1) === ":") {
|
||||
if (path.charAt(2) === directorySeparator) return 3;
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1574,7 +1574,6 @@ namespace ts {
|
||||
}
|
||||
if (path.charCodeAt(1) === CharacterCodes.colon) {
|
||||
if (path.charCodeAt(2) === CharacterCodes.slash) return 3;
|
||||
return 2;
|
||||
}
|
||||
// Per RFC 1738 'file' URI schema has the shape file://<host>/<path>
|
||||
// if <host> is omitted then it is assumed that host value is 'localhost',
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
tests/cases/compiler/declarationEmitRelativeModuleError.ts(5,16): error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitRelativeModuleError.ts (1 errors) ====
|
||||
declare module "b:block" { // <-- no error anymore
|
||||
|
||||
}
|
||||
|
||||
declare module "b:/block" { // <-- still an error
|
||||
~~~~~~~~~~
|
||||
!!! error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
//// [declarationEmitRelativeModuleError.ts]
|
||||
declare module "b:block" { // <-- no error anymore
|
||||
|
||||
}
|
||||
|
||||
declare module "b:/block" { // <-- still an error
|
||||
|
||||
}
|
||||
|
||||
//// [declarationEmitRelativeModuleError.js]
|
||||
@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/declarationEmitRelativeModuleError.ts ===
|
||||
declare module "b:block" { // <-- no error anymore
|
||||
No type information for this code.
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
No type information for this code.declare module "b:/block" { // <-- still an error
|
||||
No type information for this code.
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/declarationEmitRelativeModuleError.ts ===
|
||||
declare module "b:block" { // <-- no error anymore
|
||||
No type information for this code.
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
No type information for this code.declare module "b:/block" { // <-- still an error
|
||||
No type information for this code.
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@ -0,0 +1,7 @@
|
||||
declare module "b:block" { // <-- no error anymore
|
||||
|
||||
}
|
||||
|
||||
declare module "b:/block" { // <-- still an error
|
||||
|
||||
}
|
||||
@ -61,7 +61,6 @@ function getRootLength(path: string): number {
|
||||
}
|
||||
if (path.charAt(1) === ":") {
|
||||
if (path.charAt(2) === directorySeparator) return 3;
|
||||
return 2;
|
||||
}
|
||||
// Per RFC 1738 'file' URI schema has the shape file://<host>/<path>
|
||||
// if <host> is omitted then it is assumed that host value is 'localhost',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user