Skip to content

Commit 91ebb24

Browse files
mhausnercopybara-github
authored andcommitted
Implement type translation of types with spread operator
PiperOrigin-RevId: 628548201
1 parent d5c2921 commit 91ebb24

File tree

223 files changed

+5039
-2683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+5039
-2683
lines changed

demo/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"dependencies": {
99
"minimist": "^1.2.3",
1010
"tsickle": "file:../",
11-
"typescript": "5.2.2"
11+
"typescript": "5.4.2"
1212
},
1313
"devDependencies": {
1414
"@types/minimist": "1.2.0",

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"out/src/*"
1212
],
1313
"peerDependencies": {
14-
"typescript": "~5.1.5"
14+
"typescript": "~5.4.2"
1515
},
1616
"devDependencies": {
1717
"@types/diff-match-patch": "^1.0.32",
@@ -28,7 +28,7 @@
2828
"source-map-support": "^0.5.19",
2929
"tslib": "^2.2.0",
3030
"tslint": "^6.1.3",
31-
"typescript": "5.2.2"
31+
"typescript": "5.4.2"
3232
},
3333
"scripts": {
3434
"build": "tsc",

src/annotator_host.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ export interface AnnotatorHost {
5353
* prefix to scope symbols in externs file (see externs.ts).
5454
*/
5555
export function moduleNameAsIdentifier(
56-
host: AnnotatorHost, fileName: string, context = ''): string {
56+
host: AnnotatorHost,
57+
fileName: string,
58+
context = '',
59+
): string {
5760
return host.pathToModuleName(context, fileName).replace(/\./g, '$');
5861
}

src/cli_support.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export function assertAbsolute(fileName: string) {
2525
* import and generates a googmodule module name for the imported module.
2626
*/
2727
export function pathToModuleName(
28-
rootModulePath: string, context: string, fileName: string): string {
28+
rootModulePath: string,
29+
context: string,
30+
fileName: string,
31+
): string {
2932
fileName = fileName.replace(/(\.d)?\.[tj]s$/, '');
3033

3134
if (fileName[0] === '.') {
@@ -37,7 +40,9 @@ export function pathToModuleName(
3740
// TODO(evanm): various tests assume they can import relative paths like
3841
// 'foo/bar' and have them interpreted as root-relative; preserve that here.
3942
// Fix this by removing the next line.
40-
if (!path.isAbsolute(fileName)) fileName = path.join(rootModulePath, fileName);
43+
if (!path.isAbsolute(fileName)) {
44+
fileName = path.join(rootModulePath, fileName);
45+
}
4146

4247
// TODO(evanm): various tests assume they can pass in a 'fileName' like
4348
// 'goog:foo.bar' and have this function do something reasonable.
@@ -50,8 +55,10 @@ export function pathToModuleName(
5055
}
5156

5257
// Replace characters not supported by goog.module.
53-
const moduleName =
54-
fileName.replace(/\/|\\/g, '.').replace(/^[^a-zA-Z_$]/, '_').replace(/[^a-zA-Z0-9._$]/g, '_');
58+
const moduleName = fileName
59+
.replace(/\/|\\/g, '.')
60+
.replace(/^[^a-zA-Z_$]/, '_')
61+
.replace(/[^a-zA-Z0-9._$]/g, '_');
5562

5663
return moduleName;
5764
}

src/closure_externs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ var ReadonlySet;
6060
* @template T
6161
* @extends {IThenable<T>}
6262
*/
63-
function PromiseLike() {};
63+
function PromiseLike() {}
6464

6565
/** @typedef {function(new:Promise)} */
6666
var PromiseConstructor;
@@ -94,7 +94,7 @@ var TemplateStringsArray;
9494
var RegExpMatchArray;
9595

9696
/** @record */
97-
function ImportMeta() {};
97+
function ImportMeta() {}
9898

9999
// Representations for TS' EventMap objects.
100100
// These are types that contain a mapping from event names to event object

0 commit comments

Comments
 (0)