To enable Code Completion / IntelliSense in Visual Studio Code, it is often useful to provide additional type information by hand-crafting a *.d.ts
file like cmsbs-conf/cse/plugins/de.pinuts.customer/shared/index.d.ts
.
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 line to all your .es6
and .mjs
files to help VSC to find all your source files:
/// <reference path="../../../.vscode.js"/>
Below are some examples for typical use cases:
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; }