Add default values to TypeScript declaration files
See original GitHub issueDescription of the problem
Having definitions helps a lot but they are lacking the proper setting of the default value. It is usually in the comment just above each property so is there any blocker to include them as well.
See for instance:
could be:
export class WebGLRenderer implements Renderer {
// ...
autoClearColor: boolean = true;
autoClearDepth: boolean = true;
autoClearStencil: boolean = true;
// ...
}
It shouldn’t be an issue since types are actually export
ing classes and not just declare
ing them and could help parsing the codebase and monitor default allocations.
Three.js version
N/A
Browser
N/A
OS
N/A
Hardware Requirements (graphics card, VR Device, …)
N/A
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:11 (6 by maintainers)
Top Results From Across the Web
How to set default class property value in TypeScript ...
You need a constructor in order to set default values to class property. Try this: declare class Foo extends Bar { foo: number; ......
Read more >Documentation - Modules .d.ts - TypeScript
Default Exports. In CommonJS you can export any value as the default export, for example here is a regular expression module:.
Read more >A quick introduction to “Type Declaration” files and adding ...
In this lesson, we are going to take a closer look at type declaration files which are one of the key ingredients of...
Read more >Documenting default interface values in typescript, or trying to...
You have a function that takes options with default values. How can you document the default values?
Read more >Declare Module Typescript With Default Parameter Functions
Data let x 3 variable initialization functionx3 default parameter value return 3. Type void is not ... Adding Type Declaration Files To A...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Alright @mrdoob, I have opened the PR here: https://github.com/mrdoob/three.js/pull/20036. For maintaining it, I guess you can tag me in the future if defaults changes and these needs to be updated?
I might be able to update the initial comment definitions and PR, then I assume if defaults are changed for some reason in the js source files, the ts declaration files should be checked in parallel with the PR or when merging.
@donmccurdy just tried in VSCode and it does: if I update
WebGLRenderer.d.ts
innode_modules/three
with@default true
:it will appear: