Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Typescript to move configuration from const to let #2853

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 60 additions & 60 deletions dist/htmx.esm.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default htmx;
export type HttpVerb = 'get' | 'head' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace' | 'patch';
export type HttpVerb = "get" | "head" | "post" | "put" | "delete" | "connect" | "options" | "trace" | "patch";
export type SwapOptions = {
select?: string;
selectOOB?: string;
Expand All @@ -10,15 +10,15 @@ export type SwapOptions = {
afterSettleCallback?: swapCallback;
};
export type swapCallback = () => any;
export type HtmxSwapStyle = 'innerHTML' | 'outerHTML' | 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' | 'delete' | 'none' | string;
export type HtmxSwapStyle = "innerHTML" | "outerHTML" | "beforebegin" | "afterbegin" | "beforeend" | "afterend" | "delete" | "none" | string;
export type HtmxSwapSpecification = {
swapStyle: HtmxSwapStyle;
swapDelay: number;
settleDelay: number;
transition?: boolean;
ignoreTitle?: boolean;
head?: string;
scroll?: 'top' | 'bottom';
scroll?: "top" | "bottom";
scrollTarget?: string;
show?: string;
showTarget?: string;
Expand Down Expand Up @@ -142,64 +142,64 @@ export type HtmxExtension = {
getSelectors: () => string[] | null;
};
declare namespace htmx {
const onLoad: (callback: (elt: Node) => void) => EventListener;
const process: (elt: string | Element) => void;
const on: (arg1: string | EventTarget, arg2: string | EventListener, arg3?: EventListener) => EventListener;
const off: (arg1: string | EventTarget, arg2: string | EventListener, arg3?: EventListener) => EventListener;
const trigger: (elt: string | EventTarget, eventName: string, detail?: any) => boolean;
const ajax: (verb: HttpVerb, path: string, context: string | Element | HtmxAjaxHelperContext) => Promise<void>;
const find: (eltOrSelector: string | ParentNode, selector?: string) => Element;
const findAll: (eltOrSelector: string | ParentNode, selector?: string) => NodeListOf<Element>;
const closest: (elt: string | Element, selector: string) => Element;
let onLoad: (callback: (elt: Node) => void) => EventListener;
let process: (elt: Element | string) => void;
let on: (arg1: EventTarget | string, arg2: string | EventListener, arg3?: EventListener) => EventListener;
let off: (arg1: EventTarget | string, arg2: string | EventListener, arg3?: EventListener) => EventListener;
let trigger: (elt: EventTarget | string, eventName: string, detail?: any | undefined) => boolean;
let ajax: (verb: HttpVerb, path: string, context: Element | string | HtmxAjaxHelperContext) => Promise<void>;
let find: (eltOrSelector: ParentNode | string, selector?: string) => Element | null;
let findAll: (eltOrSelector: ParentNode | string, selector?: string) => NodeListOf<Element>;
let closest: (elt: Element | string, selector: string) => Element | null;
function values(elt: Element, type: HttpVerb): any;
const remove: (elt: Node, delay?: number) => void;
const addClass: (elt: string | Element, clazz: string, delay?: number) => void;
const removeClass: (node: string | Node, clazz: string, delay?: number) => void;
const toggleClass: (elt: string | Element, clazz: string) => void;
const takeClass: (elt: string | Node, clazz: string) => void;
const swap: (target: string | Element, content: string, swapSpec: HtmxSwapSpecification, swapOptions?: SwapOptions) => void;
const defineExtension: (name: string, extension: HtmxExtension) => void;
const removeExtension: (name: string) => void;
const logAll: () => void;
const logNone: () => void;
const logger: any;
let remove: (elt: Node, delay?: number) => void;
let addClass: (elt: Element | string, clazz: string, delay?: number) => void;
let removeClass: (node: Node | string, clazz: string, delay?: number) => void;
let toggleClass: (elt: Element | string, clazz: string) => void;
let takeClass: (elt: Node | string, clazz: string) => void;
let swap: (target: string | Element, content: string, swapSpec: HtmxSwapSpecification, swapOptions?: SwapOptions) => void;
let defineExtension: (name: string, extension: HtmxExtension) => void;
let removeExtension: (name: string) => void;
let logAll: () => void;
let logNone: () => void;
let logger: any;
namespace config {
const historyEnabled: boolean;
const historyCacheSize: number;
const refreshOnHistoryMiss: boolean;
const defaultSwapStyle: HtmxSwapStyle;
const defaultSwapDelay: number;
const defaultSettleDelay: number;
const includeIndicatorStyles: boolean;
const indicatorClass: string;
const requestClass: string;
const addedClass: string;
const settlingClass: string;
const swappingClass: string;
const allowEval: boolean;
const allowScriptTags: boolean;
const inlineScriptNonce: string;
const inlineStyleNonce: string;
const attributesToSettle: string[];
const withCredentials: boolean;
const timeout: number;
const wsReconnectDelay: "full-jitter" | ((retryCount: number) => number);
const wsBinaryType: BinaryType;
const disableSelector: string;
const scrollBehavior: 'auto' | 'instant' | 'smooth';
const defaultFocusScroll: boolean;
const getCacheBusterParam: boolean;
const globalViewTransitions: boolean;
const methodsThatUseUrlParams: (HttpVerb)[];
const selfRequestsOnly: boolean;
const ignoreTitle: boolean;
const scrollIntoViewOnBoost: boolean;
const triggerSpecsCache: any | null;
const disableInheritance: boolean;
const responseHandling: HtmxResponseHandlingConfig[];
const allowNestedOobSwaps: boolean;
let historyEnabled: boolean;
let historyCacheSize: number;
let refreshOnHistoryMiss: boolean;
let defaultSwapStyle: HtmxSwapStyle;
let defaultSwapDelay: number;
let defaultSettleDelay: number;
let includeIndicatorStyles: boolean;
let indicatorClass: string;
let requestClass: string;
let addedClass: string;
let settlingClass: string;
let swappingClass: string;
let allowEval: boolean;
let allowScriptTags: boolean;
let inlineScriptNonce: string;
let inlineStyleNonce: string;
let attributesToSettle: string[];
let withCredentials: boolean;
let timeout: number;
let wsReconnectDelay: "full-jitter" | ((retryCount: number) => number);
let wsBinaryType: BinaryType;
let disableSelector: string;
let scrollBehavior: "auto" | "instant" | "smooth";
let defaultFocusScroll: boolean;
let getCacheBusterParam: boolean;
let globalViewTransitions: boolean;
let methodsThatUseUrlParams: (HttpVerb)[];
let selfRequestsOnly: boolean;
let ignoreTitle: boolean;
let scrollIntoViewOnBoost: boolean;
let triggerSpecsCache: any | null;
let disableInheritance: boolean;
let responseHandling: HtmxResponseHandlingConfig[];
let allowNestedOobSwaps: boolean;
}
const parseInterval: (str: string) => number;
const _: (str: string) => any;
const version: string;
let parseInterval: (str: string) => number | undefined;
let _: (str: string) => any;
let version: string;
}
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"types-check": "tsc src/htmx.js --noEmit --checkJs --target es6 --lib dom,dom.iterable",
"types-generate": "tsc dist/htmx.esm.js --declaration --emitDeclarationOnly --allowJs --outDir dist",
"test": "npm run lint && npm run types-check && mocha-chrome test/index.html",
"type-declarations": "tsc --project ./jsconfig.json",
"ws-tests": "cd ./test/ws-sse && node ./server.js",
"www": "bash ./scripts/www.sh",
"sha": "bash ./scripts/sha.sh"
Expand Down Expand Up @@ -78,7 +77,7 @@
"mocha-webdriver": "^0.3.2",
"mock-socket": "^9.3.1",
"sinon": "^9.2.4",
"typescript": "^4.9.5",
"typescript": "^5.5.4",
"uglify-js": "^3.17.4",
"ws": "^8.14.2"
}
Expand Down
203 changes: 0 additions & 203 deletions src/htmx.d.ts

This file was deleted.

Loading