GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — RFC: declarative app preferences by sitefinitysteve · Pull Request #54 · NativeScript/rfcs

Conversation

@sitefinitysteve

@sitefinitysteve sitefinitysteve commented Sep 8, 2026

Copy link
Copy Markdown

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: ebcf1b77-c1c0-4fdf-8dc3-113368e5ac6f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sitefinitysteve

sitefinitysteve commented Sep 8, 2026

Copy link
Copy Markdown
Author

I just THINK... having a proper preferences story in the project that's supported and polished instead of just "Store some crap as strings in a generic ApplicationSettings object" (not that you still can't) is just NICER to be a core feature.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sitefinitysteve
RFC: declarative app preferences
6b22f52
@sitefinitysteve
sitefinitysteve force-pushed the rfc-declarative-app-preferences branch from 354c569 to 6b22f52 Compare September 8, 2026 23:17
@rigor789

rigor789 commented Sep 8, 2026

Copy link
Copy Markdown
Member

I feel like authoring the definition in TypeScript would be a nice approach, fully typed, and could directly serve as the runtime types too. Something like

// src/app.preferences.ts (or wherever)

import { definePreferences } from "@nativescript/preferences";

export default definePreferences({
 /* ... */
});

The definePreferences ensures correct schema, and provides intellisense to editors.

Usage becomes:

import settings from './app.preferences';

settings.get('theme');            // 'system' | 'light' | 'dark', never undefined
settings.set('volume', 80);       // NSUserDefaults / SharedPreferences
settings.set('enabled', 'yes');   // compile error
settings.onChange('theme', applyTheme);
await settings.openSettings();
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sitefinitysteve added a commit to sitefinitysteve/nativescript-preferences that referenced this pull request Sep 9, 2026
@sitefinitysteve
Author settings in TypeScript with definePreferences
f5c4b4d
Settings are declared in app/app.preferences.ts as
`export default definePreferences({ items })`. Keys and value types are
inferred from the literal and the default export is the typed instance, so
there is no generated settings.generated.ts any more. The before-prepare
hook evaluates the same file under Node with ts.transpileModule, the way
the CLI reads nativescript.config.ts, and writes Settings.bundle and
preferences.xml from it as before. preferences.json keeps working.

Requires TypeScript 5.3 or newer for the typings (verified through 7.0).
TypeScript 7 no longer ships the compiler API, so the loader falls back to
the NativeScript CLI's own typescript when the project's cannot transpile.

Demo moved to app/app.preferences.ts; its native output is byte-identical
to the JSON version. Also pins decode-uri-component 0.5 in the demo.

Suggested by the core team on the RFC:
NativeScript/rfcs#54 (comment)
sitefinitysteve added 2 commits September 8, 2026 20:33
@sitefinitysteve
Author the definition in TypeScript
a5494e8
Per review: the settings are declared in app/app.preferences.ts with
definePreferences, which infers the keys and value types and is the
runtime instance, so no TypeScript module is generated. The hook reads
the file under Node the way the CLI reads nativescript.config.ts.
preferences.json stays supported. Implemented in nativescript-preferences 3.0.
@sitefinitysteve
Reference nativescript-preferences 2.1
5440f97
@sitefinitysteve

sitefinitysteve commented Sep 9, 2026

Copy link
Copy Markdown
Author

I feel like authoring the definition in TypeScript would be a nice approach, fully typed, and could directly serve as the runtime types too.

I JUST upgraded it from the dated plugin years ago, easy swap, it's checked in per your notes, runs fine on both sims

https://github.com/sitefinitysteve/nativescript-preferences/releases/tag/v2.1.0

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@sitefinitysteve @rigor789
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.