Add TypeScript support for mastodon
alias and image imports (#24895)
This commit is contained in:
parent
76264e3fe8
commit
7c1305b3a4
3 changed files with 45 additions and 4 deletions
|
@ -5,9 +5,7 @@ import { FormattedMessage } from 'react-intl';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
// @ts-expect-error
|
|
||||||
import ShortNumber from 'mastodon/components/short_number';
|
import ShortNumber from 'mastodon/components/short_number';
|
||||||
// @ts-expect-error
|
|
||||||
import Skeleton from 'mastodon/components/skeleton';
|
import Skeleton from 'mastodon/components/skeleton';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
|
34
app/javascript/types/image.d.ts
vendored
Normal file
34
app/javascript/types/image.d.ts
vendored
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
declare module '*.avif' {
|
||||||
|
const path: string;
|
||||||
|
export default path;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '*.gif' {
|
||||||
|
const path: string;
|
||||||
|
export default path;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '*.jpg' {
|
||||||
|
const path: string;
|
||||||
|
export default path;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '*.jpg' {
|
||||||
|
const path: string;
|
||||||
|
export default path;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '*.png' {
|
||||||
|
const path: string;
|
||||||
|
export default path;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '*.svg' {
|
||||||
|
const path: string;
|
||||||
|
export default path;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '*.webp' {
|
||||||
|
const path: string;
|
||||||
|
export default path;
|
||||||
|
}
|
|
@ -7,7 +7,16 @@
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true,
|
||||||
|
"baseUrl": "./",
|
||||||
|
"paths": {
|
||||||
|
"mastodon": ["app/javascript/mastodon"],
|
||||||
|
"mastodon/*": ["app/javascript/mastodon/*"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"include": ["app/javascript/mastodon", "app/javascript/packs"]
|
"include": [
|
||||||
|
"app/javascript/mastodon",
|
||||||
|
"app/javascript/packs",
|
||||||
|
"app/javascript/types"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue