Skip to content

Commit 951175a

Browse files
author
Raphaël Balet
committed
refactor: types
1 parent a7ef772 commit 951175a

File tree

6 files changed

+47
-24
lines changed

6 files changed

+47
-24
lines changed

package-lock.json

+19-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-translate-multi-http-loader",
3-
"version": "18.2.0",
3+
"version": "18.3.0",
44
"license": "MIT",
55
"author": "Raphael Balet",
66
"maintainers": [
@@ -47,7 +47,7 @@
4747
"karma-jasmine": "^5.1.0",
4848
"karma-jasmine-html-reporter": "^2.1.0",
4949
"ng-packagr": "^18.1.0",
50-
"typescript": "5.4.5"
50+
"typescript": "^5.5.4"
5151
},
5252
"release": {
5353
"extends": "@semantic-release/apm-config"

projects/multi-http-loader/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-translate-multi-http-loader",
3-
"version": "18.2.0",
3+
"version": "18.3.0",
44
"license": "MIT",
55
"author": {
66
"name": "Raphaël Balet",

projects/multi-http-loader/src/lib/multi-http-loader.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ export class MultiTranslateHttpLoader implements TranslateLoader {
1919
public getTranslation(lang: string): Observable<any> {
2020
const requests: Observable<Object | {}>[] = this._resourcesPrefix.map((resource) => {
2121
let path: string
22-
if (resource.prefix) path = `${resource.prefix}${lang}${resource.suffix || '.json'}`
23-
else path = `${resource}${lang}.json`
22+
23+
if (typeof resource === 'string') path = `${resource}${lang}.json`
24+
else path = `${resource.prefix}${lang}${resource.suffix || '.json'}`
2425

2526
return new HttpClient(this._handler).get(path).pipe(
2627
catchError((res) => {
27-
if (!resource.optional) {
28+
if (typeof resource !== 'string' && !resource.optional) {
2829
console.group()
2930
console.error('Something went wrong for the following translation file:', path)
3031
console.error(res)

projects/multi-http-loader/tsconfig.lib.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
21
{
32
"extends": "../../tsconfig.json",
43
"compilerOptions": {
54
"outDir": "../../out-tsc/lib",
6-
"target": "es2015",
7-
"declaration": true,
85
"declarationMap": true,
6+
"target": "es2020",
7+
"declaration": true,
98
"inlineSources": true,
109
"types": [],
1110
"lib": ["dom", "es2018"]
1211
},
1312
"angularCompilerOptions": {
1413
"skipTemplateCodegen": true,
1514
"strictMetadataEmit": true,
15+
"fullTemplateTypeCheck": true,
16+
"strictInjectionParameters": true,
1617
"enableResourceInlining": true
1718
},
1819
"exclude": ["src/test.ts", "**/*.spec.ts"]

tsconfig.json

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
{
2+
"compileOnSave": false,
23
"compilerOptions": {
34
"baseUrl": "./",
45
"outDir": "./dist/out-tsc",
5-
"noImplicitOverride": true,
6-
"noUnusedParameters": true,
6+
"sourceMap": true,
7+
"declaration": false,
8+
"strict": true,
9+
"module": "ES2022",
710
"moduleResolution": "node",
8-
"module": "es2020",
11+
"emitDecoratorMetadata": true,
12+
"experimentalDecorators": true,
13+
"importHelpers": true,
914
"target": "ES2022",
10-
"declaration": false,
11-
"useDefineForClassFields": false
15+
"typeRoots": ["node_modules/@types"],
16+
"lib": ["ES2022", "dom"],
17+
"paths": {
18+
"ngx-mat-input-tel": ["dist/ngx-mat-input-tel"],
19+
"ngx-mat-input-tel/*": ["dist/ngx-mat-input-tel/*"]
20+
}
1221
},
1322
"angularCompilerOptions": {
23+
"enableI18nLegacyMessageIdFormat": false,
24+
"strictInjectionParameters": true,
25+
"strictInputAccessModifiers": true,
1426
"strictTemplates": true
1527
}
1628
}

0 commit comments

Comments
 (0)