Skip to content

Commit dcbbd88

Browse files
authoredAug 18, 2021
fix(types): export all types as "type" to avoid exporting in .js (#4837)
* fix(types): export all types as "type" to avoid exporting in .js This issue is caused by `export * from './types'` added in #4834, which causes everything in /types to be exposed, but unfortunately because `export from` in the InstantSearch file mixed a type and a value, and thus exported it. This is done by enabling [consistent-type-imports](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-imports.md) in eslint to make sure it's correct in all cases references: - code that throws: https://unpkg.com/browse/instantsearch.js@4.27.1/es/types/instantsearch.js - vite reproduction: https://github.com/eunjae-lee/vue-instantsearch-with-vue3-and-vite * fix ts * chore(ts): also enable `isolatedModules` this catches when you export something that's a type as a regular export, further avoiding the issue
1 parent 6e62930 commit dcbbd88

File tree

239 files changed

+723
-610
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

239 files changed

+723
-610
lines changed
 

‎.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ module.exports = {
5151
},
5252
},
5353
],
54+
'@typescript-eslint/consistent-type-imports': 'error',
5455
},
5556
overrides: [
5657
{

‎examples/e-commerce/src/routing.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/* eslint complexity: off */
22

3-
import {
4-
history as historyRouter,
5-
UiState,
6-
} from 'instantsearch.js/es/lib/routers';
3+
import type { UiState } from 'instantsearch.js/es/lib/routers';
4+
import { history as historyRouter } from 'instantsearch.js/es/lib/routers';
75
import {
86
getFallbackHitsPerPageRoutingValue,
97
getFallbackSortByRoutingValue,

0 commit comments

Comments
 (0)