...
You’ll need to run gradle vscode
to have your new file added to cmsbs-conf/cse/.vscode.js
. Also keep in mind to add the following lines to the top of all your .es6
and .mjs
files to help VSC to find all your source files and prefer import over require:
...
Below are some examples for typical use cases:.
Export a class
Codeblock | ||
---|---|---|
| ||
declare module '@de.pinuts.apirouter/shared/routing.es6' {
type HandlerFunction = (req?: HttpRequest, res?: HttpResponse) => any;
export class RouterBuilder {
/**
* Adds a route for handling GET requests.
*
* @param pathPattern {String} URL pattern; e.g. `/v3/document/:id`
* @param handler {function(req, res, next)} The handler function to be called.
* @returns RouterBuilder
*/
get(pattern: string, handler: HandlerFunction | Array<HandlerFunction>): RouterBuilder;
}
/**
* Creates a (very!) simple reverse proxy to the given upstream URL.
* Only GET requests are supported by now.
*
* @param {string} upstreamUrl
* @param {Object} [options]
* @return HandlerFunction
*/
export function proxy(upstreamUrl: string, options?: Object): HandlerFunction;
}
|
...
More examples
Codeblock | ||
---|---|---|
| ||
declare module '@de.pinuts.customer/shared/config.mjs' { const config: { env: string, oracle: { api: Object } }; export default config; } declare module '@de.pinuts.customer/shared/client.mjs' { import HttpClient from '@de.pinuts.http/shared/HttpClient.es6'; export function client(): HttpClient; } declare module '@de.pinuts.customer/shared/oracleQueue.mjs' { import SyncQueue from "@de.pinuts.cmsbs.syncqueue/shared/SyncQueue.es6"; export var oracleQueue: SyncQueue; export default oracleQueue; } declare module '@de.pinuts.customer/shared/ApplicationStatus.mjs' { const ApplicationStatus: { IN_PROGRESS: number, SUBMITTED_BY_APPLICANT: number, REGISTERED_IN_ORACLE: number, REGISTERED_IN_ENAIO: number, IN_DECISION: number, }; export default ApplicationStatus; } declare module '@de.pinuts.customer/shared/faker.es6' { const faker = { random: { number: (options: {min?: number, max?: number} | undefined) => number, arrayElement: (arr: Array) => any }, commerce: { price: (min: number, max: number, dec: number, symbol: string) => string, }, internet: { email: (firstName?: string, lastName?: string, provider?: string) => string, userName: (firstName?: string, lastName?: string) => string } }; export default faker; } |