Skip to content

Commit ef2a41a

Browse files
rohal12Your Name
andauthored
🤖 Merge PR DefinitelyTyped#71873 [twine-sugarcube] fixes for missing properties added in 2.37.0 by @rohal12
Co-authored-by: Your Name <[email protected]>
1 parent 755e55a commit ef2a41a

File tree

6 files changed

+37
-0
lines changed

6 files changed

+37
-0
lines changed

‎types/twine-sugarcube/extensions.d.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,13 @@ declare global {
683683
* $('#the-box').wiki('Who //are// you?'); // Appends "Who <em>are</em> you?" to the target element
684684
*/
685685
wiki(...sources: string[]): this;
686+
687+
/**
688+
* Wikifies the passage by the given name and appends the result to the target element(s). Returns a reference to the current jQuery object for chaining.
689+
* @param name The name of the passage.
690+
* @since SugarCube 2.37.0
691+
*/
692+
wikiPassage(name: string): void;
686693
}
687694

688695
interface JQueryStatic {

‎types/twine-sugarcube/settings.d.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,23 @@ export interface SettingsAPI {
202202
* @since 2.0.0
203203
*/
204204
save(): void;
205+
206+
/**
207+
* Returns the setting's current value.
208+
*
209+
* **NOTE**: Calling this method is equivalent to using settings[name].
210+
* @since 2.37.0
211+
*/
212+
getValue(name: string): any;
213+
214+
/**
215+
* Sets the setting's value.
216+
*
217+
* **NOTE**: This method automatically calls the Setting.save() method.
218+
* **WARNING**: If manually changing a setting that has an associated control, be mindful that the value you set makes sense for the setting in question, elsewise shenanigans could occur—e.g., don't set a range-type setting to non-number or out-of-range values.
219+
* @since 2.37.0
220+
*/
221+
setValue(name: string, value: any): void;
205222
}
206223

207224
export {};

‎types/twine-sugarcube/test/extensions.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ RegExp.escape(s);
100100

101101
const j: JQuery = $(s).ariaDisabled(true);
102102
$(s).wiki(s);
103+
$(s).wikiPassage(s);
103104
$.wiki(s);
104105
$.wikiPassage(s);
105106

‎types/twine-sugarcube/test/settings.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Setting.addList("list", {
3434
desc: "description",
3535
});
3636

37+
Setting.setValue("blahKey", "blahValue"); // $ExpectType void
38+
Setting.getValue("blahKey"); // $ExpectType any
3739
Setting.load(); // $ExpectType void
3840
Setting.save(); // $ExpectType void
3941
Setting.reset(); // $ExpectType void

‎types/twine-sugarcube/test/ui.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Dialog.setup("Character Sheet", "charsheet");
3232
Dialog.wiki("Blah //blah// ''blah''.");
3333
Dialog.wiki(Story.get("PC Sheet").processText());
3434
Dialog.wiki(Story.get("PC Sheet").processText());
35+
Dialog.wikiPassage("PC Sheet");
3536

3637
// #endregion
3738

‎types/twine-sugarcube/ui.d.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@ export interface DialogAPI {
122122
* Dialog.wiki("Cry 'Havoc!', and let slip the //ponies// of ''friendship''.");
123123
*/
124124
wiki(wikiMarkup: string): this;
125+
/**
126+
* Renders the passage by the given name and appends it to the dialog's content area. Returns a reference to the Dialog object for chaining.
127+
*
128+
* @param name The name of the passage to render.
129+
* @since 2.37.0
130+
* @example
131+
* Dialog.wikiPassage("Inventory");
132+
*/
133+
wikiPassage(name: string): this;
125134
}
126135

127136
export interface FullscreenRequestOptions {

0 commit comments

Comments
 (0)