@@ -329,6 +329,7 @@ test("module resolution should not try to resolve @noResolution annotation", ()
329329 . expectToHaveNoDiagnostics ( ) ;
330330} ) ;
331331
332+ // https://github.com/TypeScriptToLua/TypeScriptToLua/issues/1062
332333test ( "module resolution should not rewrite @NoResolution requires in library mode" , ( ) => {
333334 const { transpiledFiles } = util . testModule `
334335 import * as json from "json";
@@ -351,6 +352,40 @@ test("module resolution should not rewrite @NoResolution requires in library mod
351352 expect ( transpiledFiles [ 0 ] . lua ) . toContain ( 'require("@NoResolution:' ) ;
352353} ) ;
353354
355+ // https://github.com/TypeScriptToLua/TypeScriptToLua/issues/1050
356+ test ( "module resolution should not try to resolve resolve-like functions" , ( ) => {
357+ util . testModule `
358+ function custom_require(this: void, value: string) {
359+ return value;
360+ }
361+
362+ namespace ns {
363+ export function require(this: void, value: string) {
364+ return value;
365+ }
366+ }
367+
368+ class MyClass {
369+ require(value: string) {
370+ return value;
371+ }
372+ }
373+ const inst = new MyClass();
374+
375+ export const result = [
376+ custom_require("value 1"),
377+ ns.require("value 2"),
378+ inst.require("value 3")
379+ ];
380+
381+ `
382+ . expectToHaveNoDiagnostics ( )
383+ . expectToEqual ( {
384+ result : [ "value 1" , "value 2" , "value 3" ] ,
385+ } ) ;
386+ } ) ;
387+
388+ // https://github.com/TypeScriptToLua/TypeScriptToLua/issues/1050
354389test ( "module resolution uses baseURL to resolve imported files" , ( ) => {
355390 util . testModule `
356391 import { foo } from "dep1";
0 commit comments