Skip to content

refactor(transloco): 💡 Allow DeepPartial for test module config#865

Merged
shaharkazaz merged 1 commit intojsverse:masterfrom
maleetz:improve-testing-module-typing
Apr 2, 2026
Merged

refactor(transloco): 💡 Allow DeepPartial for test module config#865
shaharkazaz merged 1 commit intojsverse:masterfrom
maleetz:improve-testing-module-typing

Conversation

@maleetz
Copy link
Copy Markdown
Contributor

@maleetz maleetz commented Aug 19, 2025

This allows developers using the TranslocoTestingModule to pass other options for missingHandler without duplicating the logMissingKey config already provided

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

If you try to pass { allowEmpty: true } as the missingHandler configuration for the testing module you will get the below typescript error, which requires developers to pass all properties of the missingHandler object. This type definition differs from older versions of transloco which only required a partial missingHandler object: https://github.com/jsverse/transloco/blob/transloco-3.2.0/libs/transloco/src/lib/transloco.config.ts#L14

Type '{ allowEmpty: true; }' is missing the following properties from type '{ logMissingKey: boolean; useFallbackTranslation: boolean; allowEmpty: boolean; }': logMissingKey, useFallbackTranslationts(2739)
transloco.config.ts(15, 3): The expected type comes from property 'missingHandler' which is declared here on type 'Partial<TranslocoConfig>'

What is the new behavior?

You can now pass a DeepPartial of the transloco configuration to the TranslocoTestingModule and default values will be applied by the library, which is consistent with the developer experience in the library API.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This allows developers using the TranslocoTestingModule to pass other
options for missingHandler without duplicating the logMissingKey config
already provided
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Aug 19, 2025

Open in StackBlitz

@jsverse/transloco

npm i https://pkg.pr.new/@jsverse/transloco@865

@jsverse/transloco-locale

npm i https://pkg.pr.new/@jsverse/transloco-locale@865

@jsverse/transloco-messageformat

npm i https://pkg.pr.new/@jsverse/transloco-messageformat@865

@jsverse/transloco-optimize

npm i https://pkg.pr.new/@jsverse/transloco-optimize@865

@jsverse/transloco-persist-lang

npm i https://pkg.pr.new/@jsverse/transloco-persist-lang@865

@jsverse/transloco-persist-translations

npm i https://pkg.pr.new/@jsverse/transloco-persist-translations@865

@jsverse/transloco-preload-langs

npm i https://pkg.pr.new/@jsverse/transloco-preload-langs@865

@jsverse/transloco-scoped-libs

npm i https://pkg.pr.new/@jsverse/transloco-scoped-libs@865

@jsverse/transloco-utils

npm i https://pkg.pr.new/@jsverse/transloco-utils@865

@jsverse/transloco-validator

npm i https://pkg.pr.new/@jsverse/transloco-validator@865

commit: 6728ce4

@shaharkazaz shaharkazaz merged commit f56b78d into jsverse:master Apr 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants