Enable Typescript noImplicitThis (#33250)

- Enable https://www.typescriptlang.org/tsconfig/#noImplicitThis
- Wrap Vue Template-Syntax SFCs in
[`defineComponent`](https://vuejs.org/api/general#definecomponent) which
makes type inference and linter work better
- Move `createApp` calls outside the SFCs into separate files
- Use [`PropType`](https://vuejs.org/api/utility-types#proptype-t) where
appropriate
- Some top-level component properties changed order as dictated by the
linter
- Fix all tsc and lint issues that popped up during these refactors
This commit is contained in:
silverwind 2025-01-15 21:26:17 +01:00 committed by GitHub
parent b15d01b0ce
commit 4b21a6c792
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 209 additions and 190 deletions

View file

@ -1,4 +1,4 @@
import {h} from 'vue';
import {defineComponent, h, type PropType} from 'vue';
import {parseDom, serializeXml} from './utils.ts';
import giteaDoubleChevronLeft from '../../public/assets/img/svg/gitea-double-chevron-left.svg';
import giteaDoubleChevronRight from '../../public/assets/img/svg/gitea-double-chevron-right.svg';
@ -194,10 +194,10 @@ export function svgParseOuterInner(name: SvgName) {
return {svgOuter, svgInnerHtml};
}
export const SvgIcon = {
export const SvgIcon = defineComponent({
name: 'SvgIcon',
props: {
name: {type: String, required: true},
name: {type: String as PropType<SvgName>, required: true},
size: {type: Number, default: 16},
className: {type: String, default: ''},
symbolId: {type: String},
@ -215,7 +215,7 @@ export const SvgIcon = {
attrs[`^height`] = this.size;
// make the <SvgIcon class="foo" class-name="bar"> classes work together
const classes = [];
const classes: Array<string> = [];
for (const cls of svgOuter.classList) {
classes.push(cls);
}
@ -234,4 +234,4 @@ export const SvgIcon = {
innerHTML: svgInnerHtml,
});
},
};
});