generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ts_project declaration sources from other directories
Fix #727
- Loading branch information
Showing
8 changed files
with
74 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files") | ||
load("@aspect_rules_ts//ts:defs.bzl", "ts_project") | ||
load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
|
||
ts_project( | ||
name = "lib", | ||
srcs = [ | ||
"index.ts", | ||
"//examples/global_dts_generated_tsconfig:lib_types", | ||
], | ||
tsconfig = {}, | ||
) | ||
|
||
build_test( | ||
name = "test", | ||
targets = [":lib"], | ||
) | ||
|
||
write_source_files( | ||
name = "generated_tsconfig", | ||
files = { | ||
"tsconfig_gen.json.expected": ":_gen_tsconfig_lib", | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if (myGlobalFunction(42) != myGlobalResult) { | ||
console.log('Not equal!?') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"compilerOptions":{"allowJs":false,"declaration":false,"declarationMap":false,"emitDeclarationOnly":false,"noEmit":false,"resolveJsonModule":null,"sourceMap":false},"files":["./index.ts", "./../../examples/global_dts_generated_tsconfig/index.d.ts", "./../../examples/global_dts_generated_tsconfig/global.d.ts"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
// A global definition within a .d.ts file | ||
|
||
declare function myGlobalFunction(a: number): string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
myGlobalFunction(42) | ||
;(typeof globalThis !== 'undefined' | ||
? globalThis | ||
: (window as any) | ||
).myGlobalResult = myGlobalFunction(42) | ||
|
||
export {} | ||
|
||
// A definition within a .ts file that must be compiled. | ||
declare global { | ||
const myGlobalResult: string | ||
} |
1 change: 1 addition & 0 deletions
1
examples/global_dts_generated_tsconfig/tsconfig_gen.json.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"compilerOptions":{"allowJs":false,"declaration":true,"declarationMap":false,"emitDeclarationOnly":false,"noEmit":false,"resolveJsonModule":null,"sourceMap":false},"files":["./global.d.ts", "./index.ts"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters