Skip to content

Commit 5bfd68a

Browse files
author
Claus Reinke
committed
update to TS v1.5.0-alpha (#39,#56)
1 parent 405a9ef commit 5bfd68a

File tree

6 files changed

+204
-26
lines changed

6 files changed

+204
-26
lines changed

CHANGES.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
0.3.1 to 0.4.x:
1+
0.3.1 to 0.4.5:
22

3-
- get it to compile and run with github version of TypeScript (1.5), see #39
3+
- get it to compile and run with github version of TypeScript (1.5-alpha), see #39
44

55
- 'type' command renamed to 'quickInfo' (follows LS API naming)
66
(old version is still accepted, but deprecated)

bin/lib.d.ts

+177-7
Original file line numberDiff line numberDiff line change
@@ -179,19 +179,19 @@ interface ObjectConstructor {
179179
* Prevents the modification of attributes of existing properties, and prevents the addition of new properties.
180180
* @param o Object on which to lock the attributes.
181181
*/
182-
seal(o: any): any;
182+
seal<T>(o: T): T;
183183

184184
/**
185185
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
186186
* @param o Object on which to lock the attributes.
187187
*/
188-
freeze(o: any): any;
188+
freeze<T>(o: T): T;
189189

190190
/**
191191
* Prevents the addition of new properties to an object.
192192
* @param o Object to make non-extensible.
193193
*/
194-
preventExtensions(o: any): any;
194+
preventExtensions<T>(o: T): T;
195195

196196
/**
197197
* Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object.
@@ -425,6 +425,9 @@ interface String {
425425
*/
426426
substr(from: number, length?: number): string;
427427

428+
/** Returns the primitive value of the specified object. */
429+
valueOf(): string;
430+
428431
[index: number]: string;
429432
}
430433

@@ -477,6 +480,9 @@ interface Number {
477480
* @param precision Number of significant digits. Must be in the range 1 - 21, inclusive.
478481
*/
479482
toPrecision(precision?: number): string;
483+
484+
/** Returns the primitive value of the specified object. */
485+
valueOf(): number;
480486
}
481487

482488
interface NumberConstructor {
@@ -1165,6 +1171,20 @@ interface ArrayConstructor {
11651171

11661172
declare var Array: ArrayConstructor;
11671173

1174+
interface TypedPropertyDescriptor<T> {
1175+
enumerable?: boolean;
1176+
configurable?: boolean;
1177+
writable?: boolean;
1178+
value?: T;
1179+
get?: () => T;
1180+
set?: (value: T) => void;
1181+
}
1182+
1183+
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
1184+
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
1185+
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
1186+
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
1187+
11681188
/////////////////////////////
11691189
/// IE10 ECMAScript Extensions
11701190
/////////////////////////////
@@ -14203,19 +14223,169 @@ declare function importScripts(...urls: string[]): void;
1420314223
/// Windows Script Host APIS
1420414224
/////////////////////////////
1420514225

14206-
declare var ActiveXObject: { new (s: string): any; };
14226+
14227+
interface ActiveXObject {
14228+
new (s: string): any;
14229+
}
14230+
declare var ActiveXObject: ActiveXObject;
1420714231

1420814232
interface ITextWriter {
1420914233
Write(s: string): void;
1421014234
WriteLine(s: string): void;
1421114235
Close(): void;
1421214236
}
1421314237

14238+
interface TextStreamBase {
14239+
/**
14240+
* The column number of the current character position in an input stream.
14241+
*/
14242+
Column: number;
14243+
/**
14244+
* The current line number in an input stream.
14245+
*/
14246+
Line: number;
14247+
/**
14248+
* Closes a text stream.
14249+
* It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid.
14250+
*/
14251+
Close(): void;
14252+
}
14253+
14254+
interface TextStreamWriter extends TextStreamBase {
14255+
/**
14256+
* Sends a string to an output stream.
14257+
*/
14258+
Write(s: string): void;
14259+
/**
14260+
* Sends a specified number of blank lines (newline characters) to an output stream.
14261+
*/
14262+
WriteBlankLines(intLines: number): void;
14263+
/**
14264+
* Sends a string followed by a newline character to an output stream.
14265+
*/
14266+
WriteLine(s: string): void;
14267+
}
14268+
14269+
interface TextStreamReader extends TextStreamBase {
14270+
/**
14271+
* Returns a specified number of characters from an input stream, beginning at the current pointer position.
14272+
* Does not return until the ENTER key is pressed.
14273+
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
14274+
*/
14275+
Read(characters: number): string;
14276+
/**
14277+
* Returns all characters from an input stream.
14278+
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
14279+
*/
14280+
ReadAll(): string;
14281+
/**
14282+
* Returns an entire line from an input stream.
14283+
* Although this method extracts the newline character, it does not add it to the returned string.
14284+
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
14285+
*/
14286+
ReadLine(): string;
14287+
/**
14288+
* Skips a specified number of characters when reading from an input text stream.
14289+
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
14290+
* @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
14291+
*/
14292+
Skip(characters: number): void;
14293+
/**
14294+
* Skips the next line when reading from an input text stream.
14295+
* Can only be used on a stream in reading mode, not writing or appending mode.
14296+
*/
14297+
SkipLine(): void;
14298+
/**
14299+
* Indicates whether the stream pointer position is at the end of a line.
14300+
*/
14301+
AtEndOfLine: boolean;
14302+
/**
14303+
* Indicates whether the stream pointer position is at the end of a stream.
14304+
*/
14305+
AtEndOfStream: boolean;
14306+
}
14307+
1421414308
declare var WScript: {
14309+
/**
14310+
* Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext).
14311+
*/
1421514312
Echo(s: any): void;
14216-
StdErr: ITextWriter;
14217-
StdOut: ITextWriter;
14313+
/**
14314+
* Exposes the write-only error output stream for the current script.
14315+
* Can be accessed only while using CScript.exe.
14316+
*/
14317+
StdErr: TextStreamWriter;
14318+
/**
14319+
* Exposes the write-only output stream for the current script.
14320+
* Can be accessed only while using CScript.exe.
14321+
*/
14322+
StdOut: TextStreamWriter;
1421814323
Arguments: { length: number; Item(n: number): string; };
14324+
/**
14325+
* The full path of the currently running script.
14326+
*/
1421914327
ScriptFullName: string;
14328+
/**
14329+
* Forces the script to stop immediately, with an optional exit code.
14330+
*/
1422014331
Quit(exitCode?: number): number;
14221-
}
14332+
/**
14333+
* The Windows Script Host build version number.
14334+
*/
14335+
BuildVersion: number;
14336+
/**
14337+
* Fully qualified path of the host executable.
14338+
*/
14339+
FullName: string;
14340+
/**
14341+
* Gets/sets the script mode - interactive(true) or batch(false).
14342+
*/
14343+
Interactive: boolean;
14344+
/**
14345+
* The name of the host executable (WScript.exe or CScript.exe).
14346+
*/
14347+
Name: string;
14348+
/**
14349+
* Path of the directory containing the host executable.
14350+
*/
14351+
Path: string;
14352+
/**
14353+
* The filename of the currently running script.
14354+
*/
14355+
ScriptName: string;
14356+
/**
14357+
* Exposes the read-only input stream for the current script.
14358+
* Can be accessed only while using CScript.exe.
14359+
*/
14360+
StdIn: TextStreamReader;
14361+
/**
14362+
* Windows Script Host version
14363+
*/
14364+
Version: string;
14365+
/**
14366+
* Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
14367+
*/
14368+
ConnectObject(objEventSource: any, strPrefix: string): void;
14369+
/**
14370+
* Creates a COM object.
14371+
* @param strProgiID
14372+
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
14373+
*/
14374+
CreateObject(strProgID: string, strPrefix?: string): any;
14375+
/**
14376+
* Disconnects a COM object from its event sources.
14377+
*/
14378+
DisconnectObject(obj: any): void;
14379+
/**
14380+
* Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.
14381+
* @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string.
14382+
* @param strProgID
14383+
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
14384+
*/
14385+
GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;
14386+
/**
14387+
* Suspends script execution for a specified length of time, then continues execution.
14388+
* @param intTime Interval (in milliseconds) to suspend script execution.
14389+
*/
14390+
Sleep(intTime: number): void;
14391+
};

bin/tss.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ function findConfigFile() {
558558
var fileNames;
559559
var configFile, configObject, configObjectParsed;
560560
// NOTE: partial options support only
561-
var commandLine = ts.parseCommandLine(ts.sys.args);
561+
var commandLine = ts["parseCommandLine"](ts.sys.args);
562562
if (commandLine.options.version) {
563563
console.log(require("../package.json").version);
564564
process.exit(0);

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typescript-tools",
3-
"version": "v0.4.4-testing-ts1.4",
3+
"version": "v0.4.5-testing-ts1.5",
44
"description": "TypeScript Services commandline server",
55
"bin": {
66
"tss": "bin/tss"
@@ -19,6 +19,6 @@
1919
"author": "Claus Reinke",
2020
"license": "Apache License, Version 2.0",
2121
"dependencies": {
22-
"typescript": "Microsoft/TypeScript"
22+
"typescript": "1.5.0-alpha"
2323
}
2424
}

tests/script.out

+21-13
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ node ../bin/tss.js test.ts
2525
,"textSpan":{"start":32
2626
,"length":1}
2727
,"documentation":[]
28-
,"type":"(var) s: string"
28+
,"type":"var s: string"
2929
,"docComment":""}
3030
{"kind":"var"
3131
,"kindModifiers":""
3232
,"textSpan":{"start":38
3333
,"length":1}
3434
,"documentation":[]
35-
,"type":"(var) x: {\n a: number;\n b: number;\n}"
35+
,"type":"var x: {\n a: number;\n b: number;\n}"
3636
,"docComment":""}
3737
{"def":{"fileName":"PREFIX/test.ts"
3838
,"textSpan":{"start":23
@@ -157,7 +157,12 @@ node ../bin/tss.js test.ts
157157
,"kind":"method"
158158
,"kindModifiers":"declare"
159159
,"type":"(method) String.substr(from: number, length?: number): string"
160-
,"docComment":"Gets a substring beginning at the specified location and having the specified length."}]}
160+
,"docComment":"Gets a substring beginning at the specified location and having the specified length."}
161+
,{"name":"valueOf"
162+
,"kind":"method"
163+
,"kindModifiers":"declare"
164+
,"type":"(method) String.valueOf(): string"
165+
,"docComment":"Returns the primitive value of the specified object. "}]}
161166
{"isMemberCompletion":true
162167
,"isNewIdentifierLocation":false
163168
,"entries":[{"name":"a"
@@ -306,7 +311,12 @@ var a = [];
306311
,"kind":"method"
307312
,"kindModifiers":"declare"
308313
,"type":"(method) String.substr(from: number, length?: number): string"
309-
,"docComment":"Gets a substring beginning at the specified location and having the specified length."}]}
314+
,"docComment":"Gets a substring beginning at the specified location and having the specified length."}
315+
,{"name":"valueOf"
316+
,"kind":"method"
317+
,"kindModifiers":"declare"
318+
,"type":"(method) String.valueOf(): string"
319+
,"docComment":"Returns the primitive value of the specified object. "}]}
310320
{"isMemberCompletion":true
311321
,"isNewIdentifierLocation":false
312322
,"entries":[{"name":"a"
@@ -634,12 +644,12 @@ node ../bin/tss.js empty.ts
634644
,{"name":"blur"
635645
,"kind":"function"
636646
,"kindModifiers":"declare"
637-
,"type":"(function) blur(): void"
647+
,"type":"function blur(): void"
638648
,"docComment":""}
639649
,{"name":"btoa"
640650
,"kind":"function"
641651
,"kindModifiers":"declare"
642-
,"type":"(function) btoa(rawString: string): string"
652+
,"type":"function btoa(rawString: string): string"
643653
,"docComment":""}
644654
,{"name":"break"
645655
,"kind":"keyword"
@@ -663,12 +673,12 @@ node ../bin/tss.js empty.ts
663673
,{"name":"blur"
664674
,"kind":"function"
665675
,"kindModifiers":"declare"
666-
,"type":"(function) blur(): void"
676+
,"type":"function blur(): void"
667677
,"docComment":""}
668678
,{"name":"btoa"
669679
,"kind":"function"
670680
,"kindModifiers":"declare"
671-
,"type":"(function) btoa(rawString: string): string"
681+
,"type":"function btoa(rawString: string): string"
672682
,"docComment":""}
673683
,{"name":"break"
674684
,"kind":"keyword"
@@ -832,18 +842,16 @@ node ../bin/tss.js -m commonjs issue-15.ts
832842
,"entries":[{"name":"Class"
833843
,"kind":"constructor"
834844
,"kindModifiers":"export"
835-
,"type":"(constructor) Background.Class(): Background.Class"
845+
,"type":"constructor Background.Class(): Background.Class"
836846
,"docComment":""}]}
837847
{"isMemberCompletion":true
838848
,"isNewIdentifierLocation":false
839849
,"entries":[{"name":"Class"
840850
,"kind":"constructor"
841851
,"kindModifiers":"export"
842-
,"type":"(constructor) Background.Class(): Background.Class"
852+
,"type":"constructor Background.Class(): Background.Class"
843853
,"docComment":""}]}
844-
{"isMemberCompletion":true
845-
,"isNewIdentifierLocation":false
846-
,"entries":[]}
854+
null
847855
{"isMemberCompletion":true
848856
,"isNewIdentifierLocation":false
849857
,"entries":[{"name":"a"

tss.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ var fileNames;
673673
var configFile, configObject, configObjectParsed;
674674

675675
// NOTE: partial options support only
676-
var commandLine = ts.parseCommandLine(ts.sys.args);
676+
var commandLine = ts["parseCommandLine"](ts.sys.args);
677677

678678
if (commandLine.options.version) {
679679
console.log(require("../package.json").version);

0 commit comments

Comments
 (0)