Skip to content

Commit 8f91b2d

Browse files
committed
Specify a minimum TypeScript version using typesVersions
1 parent 86155b3 commit 8f91b2d

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

.changeset/cuddly-apes-check.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/app': minor
3+
'firebase': minor
4+
---
5+
6+
Specify a minimum TypeScript version using the `typesVersions` field. Shows an error message if below.

packages/app/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"browser": "dist/esm/index.esm2017.js",
88
"module": "dist/esm/index.esm2017.js",
99
"react-native": "dist/index.cjs.js",
10+
"typesVersions": {
11+
">=4.5.0": { "*": ["./dist/app-public.d.ts"] },
12+
"<4.5.0": { "*": ["./dist/typescript-not-supported.d.ts"] }
13+
},
1014
"exports": {
1115
".": {
1216
"types": "./dist/app-public.d.ts",
@@ -49,6 +53,7 @@
4953
"devDependencies": {
5054
"@rollup/plugin-json": "6.1.0",
5155
"rollup": "2.79.2",
56+
"rollup-plugin-copy": "3.5.0",
5257
"rollup-plugin-replace": "2.2.0",
5358
"rollup-plugin-typescript2": "0.36.0",
5459
"rollup-plugin-dts": "5.3.1",

packages/app/rollup.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18+
import copy from 'rollup-plugin-copy';
1819
import typescriptPlugin from 'rollup-plugin-typescript2';
1920
import replace from 'rollup-plugin-replace';
2021
import typescript from 'typescript';
@@ -53,6 +54,14 @@ const esmBuilds = [
5354
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)),
5455
plugins: [
5556
...buildPlugins,
57+
copy({
58+
targets: [
59+
{
60+
src: './typescript-not-supported.d.ts',
61+
dest: 'dist/'
62+
}
63+
]
64+
}),
5665
replace({
5766
...generateBuildTargetReplaceConfig('esm', 2017),
5867
'__RUNTIME_ENV__': ''
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Empty typings file to log an error message for unsupported TS versions
2+
3+
"Typescript must be version 4.5 or greater.";

0 commit comments

Comments
 (0)