Skip to content

Commit 9942885

Browse files
authored
Merge pull request #123 from vue-pivottable/ts-setting
빌드 에러 수정 & 타입스크립트 규칙 세팅
2 parents 5051996 + 435de5f commit 9942885

File tree

4 files changed

+49
-6
lines changed

4 files changed

+49
-6
lines changed

src/composables/useMaterializeInput.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,17 @@ export function useMaterializeInput(dataSource, options) {
2424
for (const attr of Object.keys(record)) {
2525
if (!(attr in newAllFilters)) {
2626
newAllFilters[attr] = {}
27-
if (recordsProcessed > 0) { newAllFilters[attr].null = recordsProcessed }
27+
if (recordsProcessed > 0) {
28+
newAllFilters[attr].null = recordsProcessed
29+
}
2830
}
2931
}
3032

3133
for (const attr in newAllFilters) {
3234
const value = attr in record ? record[attr] : 'null'
33-
if (!(value in newAllFilters[attr])) { newAllFilters[attr][value] = 0 }
35+
if (!(value in newAllFilters[attr])) {
36+
newAllFilters[attr][value] = 0
37+
}
3438
newAllFilters[attr][value]++
3539
}
3640

@@ -51,7 +55,9 @@ export function useMaterializeInput(dataSource, options) {
5155

5256
watch(
5357
() => options.derivedAttributes.value,
54-
() => { processData(dataSource.value) }
58+
() => {
59+
processData(dataSource.value)
60+
}
5561
)
5662

5763
return {

src/helper/utilities.d.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
declare class PivotData {
2+
constructor(inputProps?: any)
3+
props: any
4+
getRowKeys(): any[]
5+
getColKeys(): any[]
6+
getAggregator(rowKey: any, colKey: any): any
7+
[key: string]: any
8+
}
9+
10+
declare const aggregators: Record<string, any>
11+
declare const aggregatorTemplates: Record<string, any>
12+
declare const locales: Record<string, any>
13+
declare const naturalSort: (a: any, b: any) => number
14+
declare const numberFormat: (opts?: any) => any
15+
declare const getSort: any
16+
declare const sortAs: any
17+
declare const derivers: any
18+
19+
export {
20+
PivotData,
21+
aggregators,
22+
aggregatorTemplates,
23+
locales,
24+
naturalSort,
25+
numberFormat,
26+
getSort,
27+
sortAs,
28+
derivers
29+
}

tsconfig.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
"jsx": "preserve",
1515

1616
/* Linting */
17-
"strict": true,
18-
"noImplicitAny": false,
17+
"strict": false,
18+
"strictNullChecks": true,
19+
"strictBindCallApply": true,
20+
"strictPropertyInitialization": true,
21+
"noImplicitAny": true,
1922
"noUnusedLocals": true,
2023
"noUnusedParameters": true,
2124
"noFallthroughCasesInSwitch": true,

vite.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ export default defineConfig({
2020
outDir: 'dist/types',
2121
staticImport: true,
2222
insertTypesEntry: true,
23-
rollupTypes: true
23+
rollupTypes: true,
24+
compilerOptions: {
25+
paths: {
26+
'@/helper/utilities': ['./src/helper/utilities.d.ts']
27+
}
28+
}
2429
})
2530
],
2631
build: {

0 commit comments

Comments
 (0)