Skip to content

Commit

Permalink
Add support for TypeScript fbt enum files
Browse files Browse the repository at this point in the history
Use babel for transpilation
  • Loading branch information
alexandernanberg committed Dec 17, 2024
1 parent 17f6c4d commit 80b80b2
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export default {
PHOTO: 'photo',
POST: 'post',
VIDEO: 'video',
};
} as const;
2 changes: 1 addition & 1 deletion example/src/example/Example.react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import classNames from 'classnames';
import { fbs, fbt, GenderConst, IntlVariations, setupFbtee } from 'fbtee';
import { ChangeEvent, useCallback, useState } from 'react';
import translations from '../translatedFbts.json' with { type: 'json' };
import ExampleEnum from './Example$FbtEnum.js';
import ExampleEnum from './Example$FbtEnum.ts';

let viewerContext = {
GENDER: IntlVariations.GENDER_UNKNOWN,
Expand Down
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import CommonStrings from './example/common_strings.json' with { type: 'json' };
process.env.NODE_ENV = 'development';

const globalConfig = {
extensionsToTreatAsEsm: ['.tsx'],
extensionsToTreatAsEsm: ['.ts', '.tsx'],
testEnvironment: 'node',
testMatch: ['**/__tests__/**/*-test.(js|jsx|tsx)'],
testMatch: ['**/__tests__/**/*-test.(js|jsx|ts|tsx)'],
transform: {
'\\.(j|t)sx?$': '<rootDir>/jest-preprocessor.js',
},
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-fbtee/src/bin.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#! /usr/bin/env node
#! /usr/bin/env node --experimental-strip-types

import('@nkzw/babel-plugin-fbtee/lib/bin.js');
2 changes: 1 addition & 1 deletion packages/babel-plugin-fbtee/src/bin.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env node
#! /usr/bin/env node --experimental-strip-types
const command = process.argv[2];
process.argv.splice(2, 1);

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
"target": "es2022"
},
"exclude": ["packages/*/lib/", "node_modules"],
"include": ["**/*.ts", "**/*.tsx", "example/src/example/Example$FbtEnum.js"]
"include": ["**/*.ts", "**/*.tsx"]
}

0 comments on commit 80b80b2

Please sign in to comment.