Skip to content

Commit 36c1910

Browse files
committed
TypeScript documentation - type-params, lambdas and object-type.
1 parent 24af339 commit 36c1910

2 files changed

Lines changed: 29 additions & 30 deletions

File tree

Tests/file-system-tests.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// <snippet name="file-system">
33
// # File System
44
// Using the file system requires the FileSystem module.
5-
// TODO: var fs = require("file-system"); => this will break the intellisense of the tests
65
// ``` JavaScript
76
import fs = require("file-system");
87
// ```

file-system/file-system.d.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,39 @@ declare module "file-system" {
66
/**
77
* Represents a single entity on the file system.
88
*/
9-
export class FileSystemEntity {
9+
class FileSystemEntity {
1010
/**
1111
* Gets the Date object specifying the last time this entity was modified.
1212
*/
13-
public lastModified: Date;
13+
lastModified: Date;
1414

1515
/**
1616
* Gets the name of the entity.
1717
*/
18-
public name: string;
18+
name: string;
1919

2020
/**
2121
* Gets the fully-qualified path (including the extension for a File) of the entity.
2222
*/
23-
public path: string;
23+
path: string;
2424

2525
/**
2626
* Gets the Folder object representing the parent of this entity.
2727
* Will be null for a root folder like Documents or Temporary.
2828
* This property is readonly.
2929
*/
30-
public parent: Folder;
30+
parent: Folder;
3131

3232
/**
3333
* Removes (deletes) the current Entity from the file system.
3434
*/
35-
public remove(): promises.Promise<any>;
35+
remove(): promises.Promise<any>;
3636

3737
/**
3838
* Renames the current entity using the specified name.
3939
* @param newName The new name to be applied to the entity.
4040
*/
41-
public rename(newName: string): promises.Promise<any>;
41+
rename(newName: string): promises.Promise<any>;
4242
}
4343

4444
/**
@@ -49,36 +49,36 @@ declare module "file-system" {
4949
* Checks whether a File with the specified path already exists.
5050
* @param path The path to check for.
5151
*/
52-
public static exists(path: string): boolean;
52+
static exists(path: string): boolean;
5353

5454
/**
5555
* Gets the extension of the file.
5656
*/
57-
public extension: string;
57+
extension: string;
5858

5959
/**
6060
* Gets a value indicating whether the file is currently locked, meaning a background operation associated with this file is running.
6161
*/
62-
public isLocked: boolean;
62+
isLocked: boolean;
6363

6464
/**
6565
* Gets or creates a File entity at the specified path.
6666
* @param path The path to get/create the file at.
6767
*/
68-
public static fromPath(path: string): File;
68+
static fromPath(path: string): File;
6969

7070
/**
7171
* Reads the content of the file as a string using the specified encoding (defaults to UTF-8).
7272
* @param encoding An optional value specifying the preferred encoding (defaults to UTF-8).
7373
*/
74-
public readText(encoding?: string): promises.Promise<string>;
74+
readText(encoding?: string): promises.Promise<string>;
7575

7676
/**
7777
* Writes the provided string to the file, using the specified encoding (defaults to UTF-8).
7878
* @param content The content to be saved to the file.
7979
* @param encoding An optional value specifying the preferred encoding (defaults to UTF-8).
8080
*/
81-
public writeText(content: string, encoding?: string): promises.Promise<any>;
81+
writeText(content: string, encoding?: string): promises.Promise<any>;
8282
}
8383

8484
/**
@@ -88,90 +88,90 @@ declare module "file-system" {
8888
/**
8989
* Determines whether this instance is a KnownFolder (accessed through the KnownFolders object).
9090
*/
91-
public isKnown: boolean;
91+
isKnown: boolean;
9292

9393
/**
9494
* Gets or creates a Folder entity at the specified path.
9595
* @param path The path to get/create the folder at.
9696
*/
97-
public static fromPath(path: string): Folder;
97+
static fromPath(path: string): Folder;
9898

9999
/**
100100
* Checks whether a Folder with the specified path already exists.
101101
* @param path The path to check for.
102102
*/
103-
public static exists(path: string): boolean;
103+
static exists(path: string): boolean;
104104

105105
/**
106106
* Checks whether this Folder contains an Entity with the specified name.
107107
* The path of the folder is added to the name to resolve the complete path to check for.
108108
* @param name The name of the entity to check for.
109109
*/
110-
public contains(name: string): boolean;
110+
contains(name: string): boolean;
111111

112112
/**
113113
* Deletes all the files and folders (recursively), contained within this Folder.
114114
*/
115-
public clear(): promises.Promise<any>;
115+
clear(): promises.Promise<any>;
116116

117117
/**
118118
* Gets or creates a File entity with the specified name within this Folder.
119119
* @param name The name of the file to get/create.
120120
*/
121-
public getFile(name: string): File;
121+
getFile(name: string): File;
122122

123123
/**
124124
* Gets or creates a Folder entity with the specified name within this Folder.
125125
* @param name The name of the folder to get/create.
126126
*/
127-
public getFolder(name: string): Folder;
127+
getFolder(name: string): Folder;
128128

129129
/**
130130
* Gets all the top-level entities residing within this folder.
131131
*/
132-
public getEntities(): promises.Promise<Array<FileSystemEntity>>;
132+
getEntities(): promises.Promise<Array<FileSystemEntity>>;
133133

134134
/**
135135
* Enumerates all the top-level FileSystem entities residing within this folder.
136136
* @param onEntity A callback that receives the current entity. If the callback returns false this will mean for the iteration to stop.
137137
*/
138-
public eachEntity(onEntity: (entity: FileSystemEntity) => boolean);
138+
eachEntity(onEntity: (entity: FileSystemEntity) => boolean);
139139
}
140140

141141
/**
142142
* Provides access to the top-level Folders instances that are accessible from the application. Use these as entry points to access the FileSystem.
143143
*/
144-
export module knownFolders {
144+
module knownFolders {
145145
/**
146146
* Gets the Documents folder available for the current application. This Folder is private for the application and not accessible from Users/External apps.
147147
*/
148-
export function documents(): Folder;
148+
function documents(): Folder;
149149

150150
/**
151151
* Gets the Temporary (Caches) folder available for the current application. This Folder is private for the application and not accessible from Users/External apps.
152152
*/
153-
export function temp(): Folder;
153+
function temp(): Folder;
154154
}
155155

156156
/**
157157
* Enables path-specific operations like join, extension, etc.
158158
*/
159-
export module path {
159+
module path {
160160
/**
161161
* Normalizes a path, taking care of occurrances like ".." and "//".
162162
* @param path The path to be normalized.
163163
*/
164-
export function normalize(path: string): string;
164+
function normalize(path: string): string;
165165

166166
/**
167167
* Joins all the provided string components, forming a valid and normalized path.
168168
* @param paths An array of string components to be joined.
169169
*/
170-
export function join(...paths: string[]): string;
170+
function join(...paths: string[]): string;
171171

172172
/**
173173
* Gets the string used to separate file paths.
174174
*/
175-
export var separator: string;
175+
var separator: string;
176176
}
177177
}

0 commit comments

Comments
 (0)