File tree 5 files changed +49
-1
lines changed
examples/walkthrough/flags 5 files changed +49
-1
lines changed Original file line number Diff line number Diff line change
1
+ load ("//typescript:def.bzl" , "ts_binary" , "ts_library" )
2
+
3
+ ts_library (
4
+ name = "lib" ,
5
+ srcs = [
6
+ "animal.ts" ,
7
+ "main.ts" ,
8
+ ]
9
+ )
10
+
11
+ ts_binary (
12
+ name = "flags" ,
13
+ flags = [
14
+ "--noImplicitAny" ,
15
+ ],
16
+ deps = [
17
+ ":lib" ,
18
+ ]
19
+ )
Original file line number Diff line number Diff line change
1
+ // Sample inheritance in typescript.
2
+ export default class {
3
+ constructor ( public name : string ) { }
4
+
5
+ sound ( sound : string ) {
6
+ return this . name + " goes " + sound ;
7
+ }
8
+ }
Original file line number Diff line number Diff line change
1
+ // Sample inheritance in typescript.
2
+ import Animal from './animal'
3
+
4
+ module Rescue {
5
+ export class Dog extends Animal {
6
+ constructor ( name : string ) {
7
+ super ( name ) ;
8
+ }
9
+
10
+ sound ( ) {
11
+ return "My dog " + super . sound ( "bark!" ) ;
12
+ }
13
+ }
14
+ }
15
+
16
+ let c = new Rescue . Dog ( "Colby" ) ;
17
+ c . sound ( ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ def ts_binary_impl(ctx):
20
20
inputs = files ,
21
21
outputs = [output ],
22
22
executable = ctx .executable .tsc_ ,
23
+ env = {
24
+ "FLAGS" : ' ' .join (ctx .attr .flags ),
25
+ },
23
26
arguments = ["%s" % (output .path )] + \
24
27
["%s" % x .path for x in files ])
25
28
@@ -40,6 +43,7 @@ ts_binary = rule(
40
43
executable = True ),
41
44
"deps" : attr .label_list (allow_files = True ),
42
45
"srcs" : attr .label_list (allow_files = ts_filetype ),
46
+ "flags" : attr .string_list (),
43
47
},
44
48
outputs = {
45
49
"out" : "%{name}.js"
Original file line number Diff line number Diff line change @@ -21,5 +21,5 @@ for var in "$@"; do
21
21
args+=(" $( pwd) /${var} " )
22
22
done
23
23
24
- $NAR exec " --out ${args[*]} "
24
+ $NAR exec " --module amd ${FLAGS} --outFile ${args[*]} "
25
25
touch .tsc_unlock
You can’t perform that action at this time.
0 commit comments