Skip to content

Commit

Permalink
add and execute Upgrade_20240702_IsolatedDeclarations
Browse files Browse the repository at this point in the history
  • Loading branch information
olmobrutall committed Jul 2, 2024
1 parent 177f301 commit bf08a77
Show file tree
Hide file tree
Showing 262 changed files with 299 additions and 368 deletions.
2 changes: 1 addition & 1 deletion Extensions/Signum.Alerts/AlertDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { AlertEntity, AlertMessage, AlertOperation } from './Signum.Alerts'
const MaxNumberOfAlerts = 3;
const MaxNumberOfGroups = 3;

export default function AlertDropdown(props: { keepRingingFor?: number }) {
export default function AlertDropdown(props: { keepRingingFor?: number }): React.JSX.Element {

if (!Navigator.isViewable(AlertEntity))
return null;
Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Alerts/Templates/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AlertEntity, AlertMessage } from '../Signum.Alerts'
import { AlertsClient } from '../AlertsClient'
import { useForceUpdate } from '@framework/Hooks';

export default function Alert(p: { ctx: TypeContext<AlertEntity> }) {
export default function Alert(p: { ctx: TypeContext<AlertEntity> }): React.JSX.Element {

const forceUpdate = useForceUpdate();

Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Alerts/Templates/AlertType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AutoLine } from '@framework/Lines'
import { TypeContext } from '@framework/TypeContext'
import { AlertTypeSymbol } from '../Signum.Alerts'

export default function AlertType(p : { ctx: TypeContext<AlertTypeSymbol> }){
export default function AlertType(p : { ctx: TypeContext<AlertTypeSymbol> }): React.JSX.Element {
const ctx = p.ctx;
const ctx4 = ctx.subCtx({ labelColumns: 2 });
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useForceUpdate } from '@framework/Hooks';
import { SearchValueLine } from '@framework/Search';
import { toLite } from '@framework/Signum.Entities'

export default function SendNotificationEmailTask(p: { ctx: TypeContext<SendNotificationEmailTaskEntity> }) {
export default function SendNotificationEmailTask(p: { ctx: TypeContext<SendNotificationEmailTaskEntity> }): React.JSX.Element {
const ctx = p.ctx;
const forceUpdate = useForceUpdate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SearchValueLine } from '@framework/Search';
import { ADGroupEntity } from './Signum.Authorization.ActiveDirectory';
import { AzureADQuery } from './Signum.Authorization.ActiveDirectory.Azure';

export default function ADGroup(p: { ctx: TypeContext<ADGroupEntity> }) {
export default function ADGroup(p: { ctx: TypeContext<ADGroupEntity> }): React.JSX.Element {
const ctx = p.ctx;
return (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { ChangeLogClient } from '@framework/Basics/ChangeLogClient';

export namespace ActiveDirectoryClient {

export function start(options: { routes: RouteObject[], adGroups: boolean, cachedProfilePhoto: boolean; }) {
export function start(options: { routes: RouteObject[], adGroups: boolean, cachedProfilePhoto: boolean; }): void {

ChangeLogClient.registerChangeLogModule("Signum.ActiveDirectory", () => import("./Changelog"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { TypeContext } from '@framework/TypeContext'
import { useForceUpdate } from '@framework/Hooks';
import { ActiveDirectoryConfigurationEmbedded } from './Signum.Authorization.ActiveDirectory';

export default function ActiveDirectoryConfiguration(p: { ctx: TypeContext<ActiveDirectoryConfigurationEmbedded> }) {
export default function ActiveDirectoryConfiguration(p: { ctx: TypeContext<ActiveDirectoryConfigurationEmbedded> }): React.JSX.Element {
const ctx = p.ctx;
const forceUpdate = useForceUpdate();
const ctxb = ctx.subCtx({ formGroupStyle: "Basic" });
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { LoginAuthMessage } from '../Signum.Authorization/Signum.Authorization'
import { ResetPasswordClient } from './ResetPasswordClient'
import { useStateWithPromise } from '@framework/Hooks'

export default function ForgotPasswordEmailPage() {
export default function ForgotPasswordEmailPage(): React.JSX.Element {

const [modelState, setModelState] = useStateWithPromise<ModelState | undefined>(undefined);
const [success, setSuccess] = React.useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useStateWithPromise } from '@framework/Hooks'
import { QueryString } from '@framework/QueryString'
import { LoginAuthMessage } from '../Signum.Authorization/Signum.Authorization'

export default function ResetPassword() {
export default function ResetPassword(): React.JSX.Element {
const location = useLocation();

const [modelState, setModelState] = useStateWithPromise<ModelState | undefined>(undefined);
Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Authorization/AuthAdminClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export namespace AuthAdminClient {
export let queries: boolean;
export let permissions: boolean;

export function start(options: { routes: RouteObject[], types: boolean; properties: boolean, operations: boolean, queries: boolean; permissions: boolean }) {
export function start(options: { routes: RouteObject[], types: boolean; properties: boolean, operations: boolean, queries: boolean; permissions: boolean }): void {

ChangeLogClient.registerChangeLogModule("Signum.Authorization", () => import("./Changelog"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { LoginAuthMessage } from '../Signum.Authorization'
import { AuthClient } from '../AuthClient'
import { useStateWithPromise } from '@framework/Hooks'

export default function ChangePasswordPage() {
export default function ChangePasswordPage(): React.JSX.Element {
const [modelState, setModelState] = useStateWithPromise<ModelState | undefined>(undefined);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LoginAuthMessage } from '../Signum.Authorization'
import { AuthClient } from '../AuthClient'
import { useStateWithPromise } from '@framework/Hooks'

export default function ChangePasswordSucessPage() {
export default function ChangePasswordSucessPage(): React.JSX.Element {
return (
<div className="container sf-change-password-success">
<div className="row">
Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Authorization/Login/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface LoginContext {
userName?: React.RefObject<HTMLInputElement>;
}

export default function LoginPage() {
export default function LoginPage(): React.JSX.Element {

AppContext.useTitle(AuthClient.currentUser() ? LoginAuthMessage.SwitchUser.niceToString() : LoginAuthMessage.Login.niceToString());

Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Authorization/Templates/ProfilePhoto.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function clearCache() {
urlCache = {};
}

export default function ProfilePhoto(p: { user: UserEntity, size: number }) {
export default function ProfilePhoto(p: { user: UserEntity, size: number }): React.JSX.Element {
const [imageError, setImageError] = useState(false);
let url = useCachedUrl(p.user, p.size!);

Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Authorization/Templates/Role.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { SearchValue, SearchValueLine } from '@framework/Search';
import { getToString } from '@framework/Signum.Entities';
import { AuthMessage } from '../Signum.Authorization';

export default function Role(p: { ctx: TypeContext<RoleEntity> }) {
export default function Role(p: { ctx: TypeContext<RoleEntity> }): React.JSX.Element {
const forceUpdate = useForceUpdate();

function rolesMessage(r: RoleEntity) {
Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Authorization/Templates/User.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { CultureClient } from '@framework/Basics/CultureClient'
import { useAPI } from '@framework/Hooks'
import { Dic } from '@framework/Globals'

export default function User(p: { ctx: TypeContext<UserEntity> }) {
export default function User(p: { ctx: TypeContext<UserEntity> }): React.JSX.Element {

const ctx = p.ctx.subCtx({ labelColumns: { sm: 3 } });
const entity = p.ctx.value;
Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Authorization/Templates/UserCircle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function getUserInitials(u: Lite<UserEntity>): string {
return str.split(" ").map(m => m[0]).filter((a, i) => i < 2).join("").toUpperCase() ?? "";
}

export default function UserCircle(p: { user: Lite<UserEntity>, className?: string }) {
export default function UserCircle(p: { user: Lite<UserEntity>, className?: string }): React.JSX.Element {
var color = Options.getUserColor(p.user);
return (
<span className={classes("user-circle", p.className)} style={{
Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Caching/CacheClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ChangeLogClient } from '@framework/Basics/ChangeLogClient';
export namespace CacheClient {


export function start(options: { routes: RouteObject[] }) {
export function start(options: { routes: RouteObject[] }): void {

ChangeLogClient.registerChangeLogModule("Signum.Caching", () => import("./Changelog"));

Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Caching/CacheStatisticsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useAPI, useAPIWithReload } from '@framework/Hooks'
import { SearchControl } from '@framework/Search'
import { ExceptionEntity } from '@framework/Signum.Basics'

export default function CacheStatisticsPage() {
export default function CacheStatisticsPage(): React.JSX.Element {

var [state, reloadState] = useAPIWithReload(() => CacheClient.API.view(), [], { avoidReset: true });

Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Chart/ChartClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { ChangeLogClient } from '@framework/Basics/ChangeLogClient';

export namespace ChartClient {

export function start(options: { routes: RouteObject[], googleMapsApiKey?: string, svgMap?: boolean }) {
export function start(options: { routes: RouteObject[], googleMapsApiKey?: string, svgMap?: boolean }): void {

ChangeLogClient.registerChangeLogModule("Signum.Chart", () => import("./Changelog"));

Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Chart/ColorPalette/ColorPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { EntityLink } from '@framework/Search';
import { ColorPaletteClient, ColorScheme } from './ColorPaletteClient';
import { ColorPaletteEntity, ColorPaletteMessage, SpecificColorEmbedded } from './Signum.Chart.ColorPalette';

export default function ColorPalette(p: { ctx: TypeContext<ColorPaletteEntity> }) {
export default function ColorPalette(p: { ctx: TypeContext<ColorPaletteEntity> }): React.JSX.Element {
const ctx = p.ctx;
const forceUpdate = useForceUpdate();
const ctx4 = ctx.subCtx({ formGroupStyle: "Basic" });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ColorPaletteEntity } from './Signum.Chart.ColorPalette';

export namespace ColorPaletteClient {

export function start(options: { routes: RouteObject[] }) {
export function start(options: { routes: RouteObject[] }): void {
Navigator.addSettings(new EntitySettings(ColorPaletteEntity, e => import('./ColorPalette')));

Finder.registerPropertyFormatter(ColorPaletteEntity.tryPropertyRoute(a => a.categoryName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface InitialMessageProps {
data?: ChartTable;
}

export default function InitialMessage(p: InitialMessageProps) {
export default function InitialMessage(p: InitialMessageProps): React.JSX.Element {

var dots = useInterval(p.loading ? 1000 : null, 0, d => (d + 1) % 4);

Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Chart/D3Scripts/Components/Legend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface LegendProps {
onDrillDown?: (pc: PivotColumn, e: React.MouseEvent<any> | MouseEvent) => void;
}

export default function Legend(p: LegendProps) {
export default function Legend(p: LegendProps): React.JSX.Element {

const { pivot, xRule, yRule, color } = p;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface ReactChartProps {
}


export default function ReactChart(p: ReactChartProps) {
export default function ReactChart(p: ReactChartProps): React.JSX.Element {

const isSimple = p.data == null || p.data.rows.length < ReactChart.maxRowsForAnimation;
const oldData = useThrottle(p.data, 200, { enabled: isSimple });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface TextEllipsisProps extends React.SVGProps<SVGTextElement>{
etcText?: string;
}

export default function TextEllipsis({ maxWidth, padding, children, etcText, ...atts } : TextEllipsisProps) {
export default function TextEllipsis({ maxWidth, padding, children, etcText, ...atts } : TextEllipsisProps): React.JSX.Element {

const txt = React.useRef<SVGTextElement>(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface TextIfFitsProps extends React.SVGProps<SVGTextElement>{
etcText?: string;
}

export default function TextIfFits({ maxWidth, padding, children, etcText, ...atts } : TextIfFitsProps) {
export default function TextIfFits({ maxWidth, padding, children, etcText, ...atts } : TextIfFitsProps): React.JSX.Element {

const txt = React.useRef<SVGTextElement>(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CombinedUserChartElementEmbedded, CombinedUserChartPartEntity, UserChar
import { DashboardEntity } from '../../../Signum.Dashboard/Signum.Dashboard';
import { IsQueryCachedLine } from '../../../Signum.Dashboard/Admin/Dashboard';

export default function CombinedUserChartPart(p: { ctx: TypeContext<CombinedUserChartPartEntity> }) {
export default function CombinedUserChartPart(p: { ctx: TypeContext<CombinedUserChartPartEntity> }): React.JSX.Element {
const ctx = p.ctx;

return (
Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Chart/Dashboard/Admin/UserChartPart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { UserChartPartEntity } from '../../UserChart/Signum.Chart.UserChart';
import { DashboardEntity } from '../../../Signum.Dashboard/Signum.Dashboard';
import { IsQueryCachedLine } from '../../../Signum.Dashboard/Admin/Dashboard';

export default function UserChartPart(p: { ctx: TypeContext<UserChartPartEntity> }) {
export default function UserChartPart(p: { ctx: TypeContext<UserChartPartEntity> }): React.JSX.Element {
const ctx = p.ctx;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface CombinedUserChartInfoTemp {
error?: any;
}

export default function CombinedUserChartPart(p: PanelPartContentProps<CombinedUserChartPartEntity>) {
export default function CombinedUserChartPart(p: PanelPartContentProps<CombinedUserChartPartEntity>): React.JSX.Element {

const forceUpdate = useForceUpdate();

Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Chart/Dashboard/View/UserChartPart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface UserChartPartHandler {
reloadQuery: () => void;
}

export default function UserChartPart(p: PanelPartContentProps<UserChartPartEntity>) {
export default function UserChartPart(p: PanelPartContentProps<UserChartPartEntity>): React.JSX.Element {

const chartRequest = useAPI(() => UserChartClient.Converter.toChartRequest(p.content.userChart, p.entity), [p.content.userChart, p.entity && liteKey(p.entity), ...p.deps ?? []]);
const initialSelection = React.useMemo(() => chartRequest?.filterOptions.singleOrNull(a => a.dashboardBehaviour == "UseAsInitialSelection"), [chartRequest]);
Expand Down
2 changes: 1 addition & 1 deletion Extensions/Signum.Chart/GoogleMapScripts/Heatmap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as GoogleMapsChartUtils from './GoogleMapsChartUtils';
import googleMapStyles from "./GoogleMapStyles"


export default function renderHeatmapChart(p: ChartScriptProps) {
export default function renderHeatmapChart(p: ChartScriptProps): React.JSX.Element {
return <HeatmapChartImp {...p} />
}

Expand Down
Loading

1 comment on commit bf08a77

@olmobrutall
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isolated Declarations

Note: I have been busy the last months to write the latest changes in the framework.
Many changes are too small to explain, but a few bigger ones are worth to mentions.... so I will try to catch up in the following days with the old changes.
Probably you have already done this step

Maybe the biggest friction point in SF nowadays is the compilation speed and the performance / reliability of IntelliSense in Virual Studio

In this big change, I activated isolatedDeclarations in tsconfig.json https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations

This flag makes mandatory to write the return type of all the exported functions / variables. In theory this should improve performance when compiling big project

Upgrade_20240702_IsolatedDeclarations should take most of the work but some manual work is needed.

Please sign in to comment.