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

chore: removed irrelevants | undefined #2524

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions init/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ OPTIONS:
export interface MockTTY {
prompt(
step: InitStep,
message?: string | undefined,
_default?: string | undefined,
message?: string,
_default?: string,
): string | null;
confirm(step: InitStep, message?: string | undefined): boolean;
confirm(step: InitStep, message?: string): boolean;
log(...args: unknown[]): void;
logError(...args: unknown[]): void;
}
Expand Down
2 changes: 1 addition & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class FreshReqContext<State>
render(
// deno-lint-ignore no-explicit-any
vnode: VNode<any>,
init: ResponseInit | undefined = {},
init: ResponseInit = {},
): Response | Promise<Response> {
if (arguments.length === 0) {
throw new Error(`No arguments passed to: ctx.render()`);
Expand Down
2 changes: 1 addition & 1 deletion src/dev/esbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function toPreactModPath(mod: string): string {
}
}

function preactDebugger(preactPath: string | undefined): EsbuildPlugin {
function preactDebugger(preactPath?: string): EsbuildPlugin {
return {
name: "fresh-preact-debugger",
setup(build) {
Expand Down
2 changes: 1 addition & 1 deletion src/dev/file_transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class FreshFileTransformer {

const seen = new Set<string>();

let req: TransformReq | undefined = undefined;
let req: TransformReq | undefined;
while ((req = queue.pop()) !== undefined) {
if (seen.has(req.filePath)) continue;
seen.add(req.filePath);
Expand Down
4 changes: 2 additions & 2 deletions src/jsonify/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type CustomParser = Record<string, (value: any) => unknown>;

export function parse<T = unknown>(
value: string,
custom?: CustomParser | undefined,
custom?: CustomParser,
): T {
const data = JSON.parse(value);

Expand All @@ -27,7 +27,7 @@ function unpack(
arr: unknown[],
hydrated: unknown[],
idx: number,
custom: CustomParser | undefined,
custom?: CustomParser,
): void {
if (idx in hydrated) return;

Expand Down
2 changes: 1 addition & 1 deletion src/jsonify/stringify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function serializeInner(
out: string[],
indexes: Map<unknown, number>,
value: unknown,
custom: Stringifiers | undefined,
custom?: Stringifiers,
): number {
const seenIdx = indexes.get(value);
if (seenIdx !== undefined) return seenIdx;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/fs_routes/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export async function fsRoutes<State>(

function errorMiddleware<State>(
components: AnyComponent<PageProps<unknown, State>>[],
handler: HandlerFn<unknown, State> | undefined,
handler?: HandlerFn<unknown, State>,
): MiddlewareFn<State> {
const mid = renderMiddleware<State>(components, handler);
return async function errorMiddleware(ctx) {
Expand All @@ -336,7 +336,7 @@ function errorMiddleware<State>(

function notFoundMiddleware<State>(
components: AnyComponent<PageProps<unknown, State>>[],
handler: HandlerFn<unknown, State> | undefined,
handler?: HandlerFn<unknown, State>,
): MiddlewareFn<State> {
const mid = renderMiddleware<State>(components, handler);
return async function notFoundMiddleware(ctx) {
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/fs_routes/render_middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ export type AsyncAnyComponent<P> = {
// deno-lint-ignore no-explicit-any
): Promise<VNode<any> | Response | null>;
displayName?: string;
defaultProps?: Partial<P> | undefined;
defaultProps?: Partial<P>;
};

export function renderMiddleware<State>(
components: Array<
| AnyComponent<PageProps<unknown, State>>
| AsyncAnyComponent<PageProps<unknown, State>>
>,
handler: HandlerFn<unknown, State> | undefined,
init?: ResponseInit | undefined,
handler?: HandlerFn<unknown, State>,
init?: ResponseInit,
): MiddlewareFn<State> {
return async (ctx) => {
let result: PageResponse<unknown> | undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/client/partials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function checkClientNavEnabled(el: HTMLElement) {
}

// Keep track of history state to apply forward or backward animations
let index = history.state?.index || 0;
let index: number = history.state?.index || 0;
if (!history.state) {
const state: FreshHistoryState = {
index,
Expand Down
2 changes: 1 addition & 1 deletion www/utils/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class DefaultRenderer extends Marked.Renderer {
return `<img src="${src}" alt="${alt ?? ""}" title="${title ?? ""}" />`;
}

code(code: string, info: string | undefined): string {
code(code: string, info?: string): string {
// format: tsx
// format: tsx my/file.ts
// format: tsx "This is my title"
Expand Down
Loading