Skip to content

Commit ad8b42c

Browse files
authored
fix: update exported syntax for noUncheckedIndexedAccess (#184)
1 parent 8d06191 commit ad8b42c

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

src/helpers/__tests__/__snapshots__/getDtsSnapshot.test.ts.snap

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -932,25 +932,25 @@ exports[`utils / cssSnapshots with noUncheckedIndexedAccess enabled should retur
932932
'appLogo'?: string;
933933
};
934934
export default classes;
935-
export let localClassInsideGlobal?: string;
936-
export let localClass?: string;
937-
export let localClass2?: string;
938-
export let localClassInsideLocal?: string;
939-
export let reservedWords?: string;
940-
export let nestedClassParent?: string;
941-
export let childClass?: string;
942-
export let nestedClassParentExtended?: string;
943-
export let section1?: string;
944-
export let section2?: string;
945-
export let section3?: string;
946-
export let section4?: string;
947-
export let section5?: string;
948-
export let section6?: string;
949-
export let section7?: string;
950-
export let section8?: string;
951-
export let section9?: string;
952-
export let classWithMixin?: string;
953-
export let appLogo?: string;
954-
export let appLogo?: string;
935+
export let localClassInsideGlobal: string | undefined;
936+
export let localClass: string | undefined;
937+
export let localClass2: string | undefined;
938+
export let localClassInsideLocal: string | undefined;
939+
export let reservedWords: string | undefined;
940+
export let nestedClassParent: string | undefined;
941+
export let childClass: string | undefined;
942+
export let nestedClassParentExtended: string | undefined;
943+
export let section1: string | undefined;
944+
export let section2: string | undefined;
945+
export let section3: string | undefined;
946+
export let section4: string | undefined;
947+
export let section5: string | undefined;
948+
export let section6: string | undefined;
949+
export let section7: string | undefined;
950+
export let section8: string | undefined;
951+
export let section9: string | undefined;
952+
export let classWithMixin: string | undefined;
953+
export let appLogo: string | undefined;
954+
export let appLogo: string | undefined;
955955
"
956956
`;

src/helpers/__tests__/getDtsSnapshot.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ describe('utils / cssSnapshots', () => {
286286
logger,
287287
options,
288288
});
289-
expect(dts).not.toMatch(/\w'?: string/);
290289
expect(dts).toMatchSnapshot();
291290
});
292291
});

src/helpers/createDtsExports.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export const createDtsExports = ({
3131
const classnameToProperty = (classname: string) =>
3232
`'${classname}'${possiblyUndefined ? '?' : ''}: string;`;
3333
const classnameToNamedExport = (classname: string) =>
34-
`export let ${classname}${possiblyUndefined ? '?' : ''}: string;`;
34+
`export let ${classname}: string${
35+
possiblyUndefined ? ' | undefined' : ''
36+
};`;
3537

3638
const processedClasses = Object.keys(classes)
3739
.map(transformClasses(options.classnameTransform))

0 commit comments

Comments
 (0)