Skip to content

Commit

Permalink
fix(react): types should be in compilerOptions of tsconfig.spec.json (#…
Browse files Browse the repository at this point in the history
…20290)

(cherry picked from commit 4bd4ec2)
  • Loading branch information
AgentEnder authored and FrozenPandaz committed Nov 17, 2023
1 parent 525e0ca commit 3b2b940
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions packages/react/src/generators/application/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ describe('app', () => {
'vite/client',
'node',
'vitest',
'@nx/react/typings/cssmodule.d.ts',
'@nx/react/typings/image.d.ts',
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ export function updateSpecConfig(host: Tree, options: NormalizedSchema) {
}

updateJson(host, `${options.appProjectRoot}/tsconfig.spec.json`, (json) => {
json.types = json.types || [];
const compilerOptions = json.compilerOptions ?? {};
const types = compilerOptions.types ?? [];
if (options.style === 'styled-jsx') {
json.types.push('@nx/react/typings/styled-jsx.d.ts');
types.push('@nx/react/typings/styled-jsx.d.ts');
}
json.types = [
...json.types,
types.push(
'@nx/react/typings/cssmodule.d.ts',
'@nx/react/typings/image.d.ts',
];
'@nx/react/typings/image.d.ts'
);
compilerOptions.types = types;
json.compilerOptions = compilerOptions;
return json;
});

Expand Down

0 comments on commit 3b2b940

Please sign in to comment.