Add type definitions to allow editor autocompletion / intellisense#116
Open
clagiordano wants to merge 125 commits intoRanvierMUD:3.1-previewfrom
Open
Add type definitions to allow editor autocompletion / intellisense#116clagiordano wants to merge 125 commits intoRanvierMUD:3.1-previewfrom
clagiordano wants to merge 125 commits intoRanvierMUD:3.1-previewfrom
Conversation
|
Amazing, much needed! |
|
How can I help? |
Contributor
Author
|
We only need to create a file for every missing definition that export a definition like this:
export namespace Broadcast {
let sampleProperty: type;
function methodSignature(arg1: type, arg2: type);
}on export { Broadcast, Broadcastable } from './types/Broadcast';EDIT: there are too many documented modes to do this but after a lot of tests, export declare class SampleClass extends someBaseClass {
sampleProperty: sampleType;
sampleMethod(sampleArg: sampleType): sampleReturnType;
}The last example allow to declare: class, extended class, properties and methods, also allow declaration of functions i.e. export declare function MyFunction(sampleArg: sampleType): sampleReturnType; |
Contributor
|
Having those autocompletions and typing from the .d.ts or ts-core is AMAZING! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR add a folder
typeswith one definition file for every src classes, with same name as original class and a.dsuffix, these definition are exposed using anindex.d.tson repository root that import and re export all available definitions.These additions allow an editor like vscode to automatically suggest methods, properties and arguments, making more easier especially for new users the core classes usages.
I hope that this work could be considered useful.
Available definitions:
Some working examples:
Methods list:

Function argument list:

This PR also add
typescriptand@types/nodeas dev dependency to validate definitions file using this command:npx tsc --esModuleInterop true index.d.ts